# Install cargo-hack with Homebrew, apk, Nix, pacman

Cargo subcommand to provide options for testing and continuous integration. Version 0.6.45 via Homebrew; verified 2026-05-30. Also installable with nix: nix profile install nixpkgs#cargo-hack.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

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

  Evidence: local Homebrew formula metadata

### Linux

- apk (92%):

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

  Evidence: 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
```

  Evidence: 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
```

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

## Package facts

- **Package key:** brew:cargo-hack
- **Package manager:** Homebrew
- **Version:** 0.6.45
- **Source summary:** Cargo subcommand to provide options for testing and continuous integration
- **Homepage:** <https://github.com/taiki-e/cargo-hack>
- **Repository:** <https://github.com/taiki-e/cargo-hack>
- **Last updated:** 2026-05-30T17:37:11Z
- **Generated:** 2026-08-03T19:37:03+00:00

## Executables

- cargo-hack (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 0.6.45
## Project history and usage

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.

### Project history

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.

### Adoption history

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.

### How it is used

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.

### Why package nerds care

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.

### Timeline

- 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.

### Sources

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


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Other Package-Manager Records

- 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


## Related links

- [cargo-hack](https://pkg.so/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)


## Sources

- 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
