← 返回命令列表

Linux command

rustup 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Install Rust toolchain

rustup install [stable]

Set default toolchain

rustup default [stable]

Update all toolchains

rustup update

Show installed toolchains

rustup show

Add a component

rustup component add [rustfmt]

Add a target

rustup target add [x86_64-unknown-linux-musl]

Run command with specific toolchain

rustup run [nightly] [cargo build]

Override toolchain

rustup override set [nightly]

Install nightly

rustup install nightly

Uninstall a toolchain

rustup uninstall [nightly]

说明

rustup is the Rust toolchain installer and version manager. It installs and manages multiple Rust versions (stable, beta, nightly), components (rustfmt, clippy), and cross-compilation targets. Toolchains are installed per-user in ~/.rustup. Rustup manages the active toolchain, allowing easy switching between versions globally or per-project using rust-toolchain.toml files. rustup also handles updating Rust, ensuring all installed toolchains stay current with a single command.

参数

install _toolchain_
Install a toolchain.
uninstall _toolchain_
Remove a toolchain.
update
Update installed toolchains.
default _toolchain_
Set default toolchain.
show
Show installed toolchains.
run _toolchain_ _command_
Run command with specific toolchain.
override set _toolchain_
Set directory-specific override.
override unset
Remove directory override.
component add _name_
Add component to toolchain.
component list
List available components.
target add _target_
Add compilation target.
target list
List available targets.
self update
Update rustup itself.
doc
Open Rust documentation.

FAQ

What is the rustup command used for?

rustup is the Rust toolchain installer and version manager. It installs and manages multiple Rust versions (stable, beta, nightly), components (rustfmt, clippy), and cross-compilation targets. Toolchains are installed per-user in ~/.rustup. Rustup manages the active toolchain, allowing easy switching between versions globally or per-project using rust-toolchain.toml files. rustup also handles updating Rust, ensuring all installed toolchains stay current with a single command.

How do I run a basic rustup example?

Run `rustup install [stable]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does install _toolchain_ do in rustup?

Install a toolchain.