rustup
$ rustup 基金会 低风险rustup 是 Rust 官方工具链复用器,可安装 stable、beta、nightly 编译器及 clippy、rustfmt、rust-analyzer 等组件和交叉编译目标。其查询与安装命令可无交互运行(-y),但查询结果输出纯文本而非 JSON。
brew install rustup rustup 在本地磁盘管理编译器二进制、交叉编译目标与 rust-toolchain.toml 覆盖配置,MCP 无法替代本地工具链管理。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
确定性的 show、toolchain list、target list --installed 与 check 可无提示无头运行,但不支持 --json 输出或 --dry-run。
rustup showandrustup checkrun cleanly non-interactively- No
--jsonoutput flag across query commands
从官方源下载经校验的 Rust 清单到 ~/.rustup/,并原生遵循项目级 rust-toolchain.toml 版本锁定。
- Toolchain files stay isolated in
~/.rustup/(RUSTUP_HOME)
单一静态 Rust 二进制,在 macOS、Linux 与 Windows 上均有一流支持,但完整工具链下载体积较大。
- Universal
rustup.rsinstaller and Homebrew formula across major OSes
管理 Rust 通道、clippy/rustfmt 组件与交叉编译目标的必备标准工具。
- One-command
rustup target addandrustup component add
Rust 基金会官方项目(rust-lang/rustup),采用 MIT/Apache-2.0 双重许可。
- First-party
rust-lang/rustuprepository
rust-lang.github.io/rustup/ 提供详尽的 Rustup Book 文档,且 --help 清晰明了。
- Official Rustup Book documentation
安全边界、鉴权与放权指南
无需身份认证;工具链与组件保存在本地 ~/.rustup/(或 RUSTUP_HOME)目录。
由 Rust 项目维护的 MIT OR Apache-2.0 开源 CLI,免费使用。
# rustup Agent Rules - Inspect `rustup show` and `rust-toolchain.toml` before installing new toolchains or targets. - Pass `-y` when bootstrapping via `rustup-init` and avoid changing `rustup default` globally when `rustup override` or `rust-toolchain.toml` suffices.
Agent 高频安全命令配方
只读查询(安全推荐)
rustup show
显示宿主机三元组、已安装工具链、当前目录覆盖配置及 rustc 版本。
rustup check
查询官方发布清单以报告 stable/nightly 是否有可用更新。
受控写入与预演
rustup component add clippy rustfmt
为当前工具链非交互安装官方代码检查与格式化组件。
核心优势
- + 官方权威且确定性地管理 Rust 通道、
clippy/rustfmt与交叉编译目标。 - + 在 CI 与 Agent shell 中自动遵循仓库级
rust-toolchain.toml。 - + 高速单静态二进制,子命令无交互阻塞。
注意事项与踩坑点
- !
rustup show、toolchain list与target list均不支持--json输出。 - ! 无头环境中运行初始化安装脚本(
rustup-init)必须显式传入-y。