# 使用 Homebrew, apk, Nix, pacman 安装 cargo-hack

查看 cargo-hack 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:cargo-hack
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install cargo-hack
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add cargo-hack
```

  证据: Alpine Linux edge package indexes: cargo-hack from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Nix (92%):

```sh
nix profile install nixpkgs#cargo-hack
```

  证据: nixpkgs package indexes: pkgs/by-name/ca/cargo-hack/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S cargo-hack
```

  证据: Arch Linux sync databases: cargo-hack from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

## 软件包事实

- **软件包键:** brew:cargo-hack
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/cargo-hack>
- **版本:** 0.6.45
- **来源摘要:** Cargo subcommand to provide options for testing and continuous integration
- **主页:** <https://github.com/taiki-e/cargo-hack>
- **仓库:** <https://github.com/taiki-e/cargo-hack>
- **许可证:** Apache-2.0 OR MIT
- **源码归档:** <https://github.com/taiki-e/cargo-hack/archive/refs/tags/v0.6.45.tar.gz>
- **最后更新:** 2026-05-30T17:37:11Z
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- cargo-hack (cli)
- cargo-hack (别名)

## 构建依赖

- rust

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.6.45
- 管理器更新时间: 2026-05-30
- 本地数据: OK
- 上游仓库: https://github.com/taiki-e/cargo-hack
- 检测到的最新版本: v0.6.45 (当前)
## 项目历史与用法

cargo-hack is a Cargo subcommand for testing Rust packages across feature combinations, workspace selections, and Rust version ranges. It is built for the practical pain of continuous integration in feature-heavy crates.

Its best-known commands, `--each-feature` and `--feature-powerset`, make Cargo feature-matrix testing explicit and scriptable.

### 项目历史

The cargo-hack repository was created in October 2019 and version 0.1.0 was published to crates.io the next day. The README describes it as a Cargo subcommand providing options useful for testing and continuous integration.

The project developed around gaps in Cargo's native feature testing ergonomics. Its README references several upstream Cargo issues and documents behavior around workspaces, features, optional dependencies, package selection, and Rust version checks.

### 采用历史

cargo-hack was adopted by Rust crate maintainers who needed confidence that optional features, no-default-features builds, and workspace combinations continued to compile.

Its usage fits CI particularly well because a maintainer can run ordinary Cargo subcommands through cargo-hack while expanding the matrix of features or Rust versions under test.

### 使用方式

Common usage wraps a Cargo command, for example checking every individual feature or a feature powerset. The README documents `--each-feature`, `--feature-powerset`, feature exclusions, optional dependency handling, `--rust-version`, and `--version-range`.

The tool also improves or extends behavior around existing Cargo flags such as workspace/package selection and manifest paths, keeping it close to Cargo rather than inventing a separate build system.

### 为什么软件包爱好者会关心

cargo-hack is important to package maintainers because Rust features form part of a crate's public compatibility surface. Testing only the default feature set can miss broken optional integrations; cargo-hack makes those combinations cheap to exercise.

It is also a good example of an ecosystem utility that exists because package metadata is combinatorial: the hard part is not installing the package, it is validating all the shapes users can request from it.

### 时间线

- 2019-10-29: GitHub repository created.
- 2019-10-30: cargo-hack 0.1.0 published to crates.io.
- 2020s: README documents feature powerset, each-feature, optional dependency, workspace, and Rust-version testing flows.
- 2026: Crate has more than 1.6 million crates.io downloads and remains active.

### Related projects

- The README lists cargo-llvm-cov, cargo-minimal-versions, and cargo-config2 as related projects by the same maintainer ecosystem.
- Cargo itself is the underlying command runner and source of many linked feature/workspace issues in the README.
- cargo-minimal-versions is especially adjacent because both tools help maintainers test package compatibility beyond the default build.

### 来源

- <https://api.github.com/repos/taiki-e/cargo-hack>
- <https://crates.io/crates/cargo-hack>
- <https://github.com/taiki-e/cargo-hack#readme>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** cargo-hack
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## 其他软件包管理器记录

- Nix - cargo-hack: normalized package name match | nixpkgs package indexes: pkgs/by-name/ca/cargo-hack/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - cargo-hack - 0.6.45-r0: normalized package name match | Alpine Linux edge package indexes: cargo-hack from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Cargo subcommand to provide various options useful for testing and continuous integration. | https://github.com/taiki-e/cargo-hack
- apk - cargo-hack-doc - 0.6.45-r0: normalized package name match | Alpine Linux edge package indexes: cargo-hack-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Cargo subcommand to provide various options useful for testing and continuous integration. (documentation) | https://github.com/taiki-e/cargo-hack
- pacman - cargo-hack - 0.6.45-1: normalized package name match | Arch Linux sync databases: cargo-hack from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A cargo subcommand to provide various options useful for testing and CI | https://github.com/taiki-e/cargo-hack


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Package publisher tools](https://pkg.so/zh-hans/package-publishers/) - Belongs to a package publishing or registry command family.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [rust](https://pkg.so/zh-hans/brew/rust/) - Build dependency declared by Homebrew.
- [cargo-nextest](https://pkg.so/zh-hans/brew/cargo-nextest/) - Shares pkgdb curated category or tags: cargo, cli, developer-tools, rust, testing.
- [cargo-insta](https://pkg.so/zh-hans/brew/cargo-insta/) - Shares pkgdb curated category or tags: cargo, cli, developer-tools, rust, testing.
- [lcov](https://pkg.so/zh-hans/brew/lcov/) - Shares pkgdb curated category or tags: cli, developer-tools, testing.
- [bats-core](https://pkg.so/zh-hans/brew/bats-core/) - Shares pkgdb curated category or tags: cli, developer-tools, testing.
- [allure](https://pkg.so/zh-hans/brew/allure/) - Shares pkgdb curated category or tags: cli, developer-tools, testing.
- [kcov](https://pkg.so/zh-hans/brew/kcov/) - Shares pkgdb curated category or tags: cli, developer-tools, testing.
- [mockolo](https://pkg.so/zh-hans/brew/mockolo/) - Shares pkgdb curated category or tags: cli, developer-tools, testing.
- [mockery](https://pkg.so/zh-hans/brew/mockery/) - Shares pkgdb curated category or tags: cli, developer-tools, testing.
- [cargo-all-features](https://pkg.so/zh-hans/brew/cargo-all-features/) - Both packages touch the same language runtime or ecosystem. Shared terms: cargo, cli, combinations, developer, developer-tools.
- [cargo-llvm-cov](https://pkg.so/zh-hans/brew/cargo-llvm-cov/) - Both packages touch the same language runtime or ecosystem. Shared terms: cargo, cli, developer, developer-tools, rust.
- [cargo-hack](https://pkg.so/zh-hans/cargo/cargo-hack/) - Same normalized package name exists in another local package ecosystem.

## Combined YAML source

View the package source record on GitHub. [combined/cargo-hack.yml](https://github.com/mxcl/pkgdb/blob/main/combined/cargo-hack.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
