# Install cargo-component with Homebrew, Nix

Create WebAssembly components based on the component model proposal. Version 0.21.1 via Homebrew; verified from local package data.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install cargo-component
```

  Evidence: local Homebrew formula metadata

### Linux

- Nix (92%):

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

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

## Package facts

- **Package key:** brew:cargo-component
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/cargo-component>
- **Version:** 0.21.1
- **Source summary:** Create WebAssembly components based on the component model proposal
- **Homepage:** <https://github.com/bytecodealliance/cargo-component>
- **Repository:** <https://github.com/bytecodealliance/cargo-component>
- **Upstream docs:** <https://github.com/bytecodealliance/cargo-component#readme>
- **License:** Apache-2.0
- **Source archive:** <https://github.com/bytecodealliance/cargo-component/archive/refs/tags/v0.21.1.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- cargo-component (cli)
- cargo-component (alias)

## Build dependencies

- rust

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 0.21.1
- Local data: ok
- Upstream repository: https://github.com/bytecodealliance/cargo-component
- Upstream latest detected: v0.21.1 (current)
- info: No package-manager update timestamp was available.
## Project history and usage

cargo-component is a Bytecode Alliance Cargo subcommand for creating WebAssembly components from Rust projects. It exists to bridge Cargo workflows with the WebAssembly component model, WIT interfaces, generated bindings, and component dependencies.

### Project history

The repository was created in 2022 under the Bytecode Alliance. Its README describes cargo-component as an experimental attempt to imagine what first-class Rust support for WebAssembly components might look like before Cargo itself has native component-model support.

The project grew alongside Bytecode Alliance work on the WebAssembly component model, wit-bindgen, Wasmtime, and WASI Preview 2. It uses Cargo.toml metadata and generates Rust bindings so component interfaces can be used in a Cargo-like development loop.

### Adoption history

Adoption has followed the WebAssembly component-model community rather than general Rust CLI usage. crates.io metadata shows hundreds of thousands of downloads by June 2026, and Homebrew and Nix packaging make it easier to install for component-model experiments and CI builds.

The README notes that Rust's upstream wasm32-wasip2 target now produces components for some WASI use cases, leaving cargo-component most relevant where projects need non-WASI WIT interfaces, component dependencies, or features not yet covered by plain Cargo.

### How it is used

The documented flow starts with `cargo component new --lib <name>` or a command component, creates a `wit/world.wit` interface, implements generated bindings in Rust, and builds with `cargo component build`.

The tool can also add and update component interface dependencies through Cargo.toml, and it supports adapter configuration in `[package.metadata.component]` for WASI Preview 1 to Preview 2 adaptation.

### Why package nerds care

cargo-component is significant because it treats WebAssembly components as packageable dependencies inside Cargo projects. For package ecosystem watchers, it is a live example of how Rust's package manager might evolve when language packages and portable component interfaces meet.

It also marks a transitional period: component-model tooling is moving quickly, and the README explicitly frames cargo-component as useful until more support lands in the Rust compiler and Cargo.

### Timeline

- 2021: crates.io records an initial cargo-component publication.
- 2022: GitHub repository created under bytecodealliance/cargo-component.
- 2024: README references Rust 1.82 adding the upstream wasm32-wasip2 target.
- 2025: GitHub releases show the 0.21.x series.

### Related projects

- The WebAssembly component model defines the component format cargo-component targets.
- wit-bindgen generates bindings for WIT interfaces and is closely related to cargo-component's generated Rust bindings.
- Wasmtime supplies WASI adapter work referenced by the README.
- Rust's wasm32-wasip2 target is an upstream alternative for some WASI-only component builds.

### Sources

- <https://api.github.com/repos/bytecodealliance/cargo-component>
- <https://crates.io/api/v1/crates/cargo-component>
- <https://github.com/bytecodealliance/cargo-component#readme>


## Security Notes

narrow executable package without higher-risk signals.

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


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: Cargo.toml, .vscode/settings.json
## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** cargo-component
- **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

## Other Package-Manager Records

- Nix - cargo-component: normalized package name match | nixpkgs package indexes: pkgs/by-name/ca/cargo-component/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Package publisher tools](https://www.automicvault.com/pkg/package-publishers/) - Belongs to a package publishing or registry command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [rust](https://www.automicvault.com/pkg/brew/rust/) - Build dependency declared by Homebrew.
- [cargo-auditable](https://www.automicvault.com/pkg/brew/cargo-auditable/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-binstall](https://www.automicvault.com/pkg/brew/cargo-binstall/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-binutils](https://www.automicvault.com/pkg/brew/cargo-binutils/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-bloat](https://www.automicvault.com/pkg/brew/cargo-bloat/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-bundle](https://www.automicvault.com/pkg/brew/cargo-bundle/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-c](https://www.automicvault.com/pkg/brew/cargo-c/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-cache](https://www.automicvault.com/pkg/brew/cargo-cache/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-careful](https://www.automicvault.com/pkg/brew/cargo-careful/) - Shares av.db curated category or tags: cargo, cli, developer-tools, rust.
- [cargo-llvm-cov](https://www.automicvault.com/pkg/brew/cargo-llvm-cov/) - Both packages touch the same language runtime or ecosystem. Shared terms: based, cargo, cli, developer, developer-tools.
- [cargo-component](https://www.automicvault.com/pkg/cargo/cargo-component/) - Same normalized package name exists in another local package ecosystem.

## Combined YAML source

View the package source record on GitHub. [combined/cargo-component.yml](https://github.com/automic-vault/db/blob/main/combined/cargo-component.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
