# 使用 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
- **版本:** 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>
- **最后更新:** 2026-05-30T17:37:11Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- cargo-hack (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.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

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

- 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


## 相关链接

- [cargo-hack](https://pkg.so/zh-hans/pkg/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
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
