# Install c2rust with Homebrew, apk

Migrate C code to Rust. Version 0.22.1 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:c2rust
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install c2rust
```

  Evidence: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add c2rust
```

  Evidence: Alpine Linux edge package indexes: c2rust from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

## Package facts

- **Package key:** brew:c2rust
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/c2rust>
- **Version:** 0.22.1
- **Source summary:** Migrate C code to Rust
- **Homepage:** <https://c2rust.com/>
- **Repository:** <https://github.com/immunant/c2rust>
- **Upstream docs:** <https://c2rust.com/manual>
- **License:** BSD-3-Clause
- **Source archive:** <https://github.com/immunant/c2rust/archive/refs/tags/v0.22.1.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- c2rust (cli)
- c2rust-transpile (cli)
- c2rust (alias)
- c2rust-transpile (alias)

## Dependencies

- llvm@21

## Build dependencies

- cmake
- rust

## Install behavior

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

## Freshness

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

C2Rust is a C99-to-Rust migration toolkit. Its core transpiler produces unsafe Rust that closely mirrors the original C so functionality and tests can be preserved before humans or refactoring tools gradually improve the Rust.

### Project history

The upstream Git history begins on 22 June 2017 with original C sources, Corrode-generated Rust sources, and early source-rewriting work. The README describes the project's goal as helping migrate C99-compliant code to Rust while preserving behavior first.

By the time of the README's RustConf 2018 reference, C2Rust had become a visible example of pragmatic Rust adoption for existing C codebases. The project grew beyond raw transpilation to include cross-checking translated code against the original and a refactoring tool intended to reduce the manual work of turning unsafe Rust into safer, more idiomatic Rust.

### Adoption history

C2Rust is packaged both as a Rust crate installed with `cargo install --locked c2rust` and through system package managers such as Homebrew and Alpine according to source_facts. The README also documents direct Git installation for users needing unreleased bug fixes.

Adoption is mostly by developers facing migration or audit work rather than everyday end users. Its requirement for LLVM/clang, compile_commands.json, and close build-system integration places it in the serious-codebase-migration category.

### How it is used

For non-trivial projects, C2Rust expects a `compile_commands.json` compilation database so libclangTooling can see the same compiler arguments used by the original C build. Users run `c2rust transpile path/to/compile_commands.json`, optionally emitting Cargo build files or specifying binary entry points.

The README also documents trivial source-file transpilation, cross-checking translated code against the original, and `c2rust refactor` tooling for follow-up transformations. Developers often need LLVM_CONFIG_PATH or related environment variables when building against specific LLVM installs.

### Why package nerds care

C2Rust is significant because it packages one of the hard parts of language migration as a CLI workflow: consume a C build database, produce Rust, run tests, then iterate. It is not magic safe Rust generation; its value is making the first migration step mechanical and reproducible.

It also represents a Rust ecosystem pattern where package-manager installation is only the entry point. Real use depends on compiler toolchains, build-system metadata, test suites, and sometimes pinned nightly Rust components for advanced refactoring tools.

### Timeline

- 2017-06-22: Upstream Git history begins with original C sources and Corrode-generated Rust sources.
- 2018: README points to a RustConf 2018 talk introducing C2Rust.
- 2018-11-02: 0.8.1 tag appears.
- 2020-10-20: 0.15.0 tag appears.
- 2023-02-01: v0.17.0 tag appears.
- 2024-08-30: v0.19.0 tag appears.
- 2025-02-24: v0.20.0 tag appears.
- 2026-02-10: v0.22.1 tag appears.

### Related projects

- Corrode: an earlier C-to-Rust translator referenced in C2Rust's initial upstream history.
- LLVM and clang/libclangTooling: parser and compilation-database infrastructure required by C2Rust.
- c2rust-refactor: sibling tool for transforming generated Rust after transpilation.
- Compiler Explorer: the README links an online C2Rust translator integration using the current master branch.

### Sources

- <https://c2rust.com/manual>
- <https://github.com/immunant/c2rust#readme>
- <https://github.com/immunant/c2rust/blob/master/docs/README-developers.md>
- source_facts.package-manager


## Security Notes

narrow executable package without higher-risk signals.

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

## Source Database Details

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

## Other Package-Manager Records

- apk - c2rust - 0.22.1-r0: normalized package name match | Alpine Linux edge package indexes: c2rust from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Transpile C99-compliant code to (unsafe) Rust code | https://github.com/immunant/c2rust


## Related links

- [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.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Language runtime packages](https://www.automicvault.com/pkg/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [llvm@21](https://www.automicvault.com/pkg/brew/llvm-21/) - Runtime dependency declared by Homebrew.
- [cmake](https://www.automicvault.com/pkg/brew/cmake/) - Build dependency declared by Homebrew.
- [rust](https://www.automicvault.com/pkg/brew/rust/) - Build dependency declared by Homebrew.
- [cbindgen](https://www.automicvault.com/pkg/brew/cbindgen/) - Shares av.db curated category or tags: c, cli, developer-tools, rust.
- [cxgo](https://www.automicvault.com/pkg/brew/cxgo/) - Shares av.db curated category or tags: c, cli, developer-tools, transpiler.
- [gdbgui](https://www.automicvault.com/pkg/brew/gdbgui/) - Shares av.db curated category or tags: c, cli, developer-tools, rust.
- [uftrace](https://www.automicvault.com/pkg/brew/uftrace/) - Shares av.db curated category or tags: c, cli, developer-tools, rust.
- [aarch64-elf-gcc](https://www.automicvault.com/pkg/brew/aarch64-elf-gcc/) - Shares av.db curated category or tags: c, cli, developer-tools.
- [abi-dumper](https://www.automicvault.com/pkg/brew/abi-dumper/) - Shares av.db curated category or tags: c, cli, developer-tools.
- [action-validator](https://www.automicvault.com/pkg/brew/action-validator/) - Shares av.db curated category or tags: cli, developer-tools, rust.
- [agent-browser](https://www.automicvault.com/pkg/brew/agent-browser/) - Shares av.db curated category or tags: cli, developer-tools, rust.
- [cppinsights](https://www.automicvault.com/pkg/brew/cppinsights/) - Local package facts share a topical domain. Shared terms: cli, code, developer, developer-tools, llvm.
- [creduce](https://www.automicvault.com/pkg/brew/creduce/) - Local package facts share a topical domain. Shared terms: c, cli, developer, developer-tools, llvm.
- [cargo-llvm-cov](https://www.automicvault.com/pkg/brew/cargo-llvm-cov/) - Both packages touch the same language runtime or ecosystem. Shared terms: cli, code, developer, developer-tools, llvm.

## Combined YAML source

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


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- 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
