# 使用 Homebrew, apk, chocolatey, dnf, MacPorts, Nix, pacman, zypper, scoop, apt 安装 rust

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

## 安装

```sh
sudo av install brew:rust
```

## 代理安全回答

rust tooling builds binaries and can publish crates through Cargo workflows.

- **凭据访问:** Reads Cargo credentials, Git credentials, environment variables, and project config.
- **远程变更:** Can run build scripts and toolchain commands that call external systems.
- **发布/制品风险:** Can publish crates and release binaries.
- **推荐控制:** Gate cargo publish, install scripts, and credentialed registry access.
- **代理使用指南:** Allow build/test/doc commands; require approval for publish and release automation.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install rust
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install rust
```

  证据: MacPorts ports tree: lang/rust/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add rust
```

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

- dnf (92%):

```sh
sudo dnf install rust
```

  证据: Fedora Rawhide package metadata: rust from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#rust
```

  证据: nixpkgs package indexes: rust from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

- pacman (92%):

```sh
sudo pacman -S rust
```

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

- zypper (92%):

```sh
sudo zypper install rust
```

  证据: openSUSE Tumbleweed package metadata: rust from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

- Debian apt (92%):

```sh
sudo apt install cargo
```

  证据: Debian stable package indexes: cargo from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

### Windows

- Chocolatey (92%):

```sh
choco install rust
```

  证据: Chocolatey community package catalog: rust from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','revouninstallerpro'

- Scoop (92%):

```sh
scoop install main/rust
```

  证据: Scoop official bucket manifest trees: bucket/rust.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:rust
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/rust>
- **版本:** 1.97.1
- **来源摘要:** Safe, concurrent, practical language
- **主页:** <https://www.rust-lang.org/>
- **仓库:** <https://github.com/rust-lang/rust>
- **上游文档:** <https://www.rust-lang.org/>
- **许可证:** Apache-2.0 OR MIT
- **源码归档:** <https://static.rust-lang.org/dist/rustc-1.97.1-src.tar.gz>
- **最后更新:** 2026-07-17T17:57:53Z
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- cargo (cli)
- cargo-clippy (cli)
- cargo-fmt (cli)
- clippy-driver (cli)
- rust-gdb (cli)
- rust-gdbgui (cli)
- rust-lldb (cli)
- rustc (cli)
- rustdoc (cli)
- rustfmt (cli)
- cargo (别名)
- cargo-clippy (别名)
- cargo-fmt (别名)
- clippy-driver (别名)
- rust-gdb (别名)
- rust-gdbgui (别名)
- rust-lldb (别名)
- rustc (别名)
- rustdoc (别名)
- rustfmt (别名)

## 依赖

- libgit2
- libssh2
- llvm
- openssl@3
- pkgconf
- sqlite

## macOS 提供的库

- curl

## 安装行为

- post-install 钩子: 未定义
- 注意事项: Link this toolchain with `rustup` under the name `system` with: rustup toolchain link system "$(brew --prefix rust)" If you use rustup, avoid PATH conflicts by following instructions in: brew info rustup
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 1.97.1
- 管理器更新时间: 2026-07-17
- 本地数据: OK
- 上游仓库: https://www.rust-lang.org/
- 信息: Release/tag comparison is only available for GitHub repositories.

## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- 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.


## Credential files

- Unix: ~/.cargo/credentials.toml, ~/.cargo/credentials
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** rust
- **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 - rust: normalized package name match | nixpkgs package indexes: rust from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- apk - cargo - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: cargo from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | The Rust package manager | https://doc.rust-lang.org/cargo/
- apk - cargo-bash-completions - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: cargo-bash-completions from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Bash completions for cargo | https://doc.rust-lang.org/cargo/
- apk - cargo-doc - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: cargo-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | The Rust package manager (documentation) | https://doc.rust-lang.org/cargo/
- apk - cargo-zsh-completion - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: cargo-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | ZSH completions for cargo | https://doc.rust-lang.org/cargo/
- apk - rust - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Rust Programming Language toolchain | https://www.rust-lang.org/
- apk - rust-clippy - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-clippy from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Lints to catch common mistakes and improve your Rust code | https://doc.rust-lang.org/clippy/
- apk - rust-clippy-doc - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-clippy-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Rust Code Linter (documentation) | https://www.rust-lang.org/
- apk - rust-dbg - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-dbg from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Rust Programming Language toolchain (debug symbols) | https://www.rust-lang.org/
- apk - rust-doc - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Rust Programming Language toolchain (documentation) | https://www.rust-lang.org/
- apk - rust-gdb - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-gdb from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | GDB pretty printers for Rust | https://rustc-dev-guide.rust-lang.org/debugging-support-in-rustc.html
- apk - rust-lldb - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-lldb from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | LLDB pretty printers for Rust | https://rustc-dev-guide.rust-lang.org/debugging-support-in-rustc.html
- apk - rust-src - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-src from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Rust Programming Language toolchain (source code) | https://github.com/rust-lang/rust/tree/1.97.0
- apk - rust-uefi - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-uefi from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | UEFI targets for rust | https://rust-osdev.com/uefi-book
- apk - rust-wasm - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rust-wasm from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | WebAssembly targets for rust | https://rust-lang.org/what/wasm/
- apk - rustc-dev - 1.97.0-r0: normalized package name match | Alpine Linux edge package indexes: rustc-dev from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Rust Programming Language toolchain (compiler libraries) | https://www.rust-lang.org/


## 相关链接

- [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.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Language runtime packages](https://pkg.so/zh-hans/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [openssl@3](https://pkg.so/zh-hans/brew/openssl-3/) - Runtime dependency declared by Homebrew.
- [sqlite](https://pkg.so/zh-hans/brew/sqlite/) - Runtime dependency declared by Homebrew.
- [pkgconf](https://pkg.so/zh-hans/brew/pkgconf/) - Runtime dependency declared by Homebrew.
- [llvm](https://pkg.so/zh-hans/brew/llvm/) - Runtime dependency declared by Homebrew.
- [libgit2](https://pkg.so/zh-hans/brew/libgit2/) - Runtime dependency declared by Homebrew.
- [pake](https://pkg.so/zh-hans/brew/pake/) - Popular package that depends on this formula.
- [anchor](https://pkg.so/zh-hans/brew/anchor/) - Popular package that depends on this formula.
- [helix-db](https://pkg.so/zh-hans/brew/helix-db/) - Popular package that depends on this formula.
- [rust-script](https://pkg.so/zh-hans/brew/rust-script/) - Popular package that depends on this formula.
- [rust-wasm](https://pkg.so/zh-hans/brew/rust-wasm/) - Popular package that depends on this formula.
- [nim](https://pkg.so/zh-hans/brew/nim/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language, systems-programming.
- [lua](https://pkg.so/zh-hans/brew/lua/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [kotlin](https://pkg.so/zh-hans/brew/kotlin/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [scala](https://pkg.so/zh-hans/brew/scala/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [julia](https://pkg.so/zh-hans/brew/julia/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [crystal](https://pkg.so/zh-hans/brew/crystal/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [fennel](https://pkg.so/zh-hans/brew/fennel/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [algol68g](https://pkg.so/zh-hans/brew/algol68g/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language.
- [c3c](https://pkg.so/zh-hans/brew/c3c/) - Local package facts share a topical domain. Shared terms: cli, compiler, language, language-runtime, llvm.

## Combined YAML source

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


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
