rustup toolchain listShows installed toolchains and which one is active.
Manage Rust toolchains with rustup, switch channels, install components, and add cross-compilation targets.
Install, list, and switch between stable, beta, nightly, and custom toolchains.
rustup toolchain listShows installed toolchains and which one is active.
rustup toolchain install nightlyNightly is commonly used for unstable features or tooling experiments.
rustup toolchain install betaBeta helps verify compatibility before stable releases.
rustup default nightlyApplies outside directories that have overrides or rust-toolchain files.
rustup override set stableDirectory overrides let a project use a different toolchain than global default.
rustup override unsetUse this when a project no longer needs a local override.
Commit toolchain choices to the repository.
[toolchain]
channel = "stable"
components = ["rustfmt", "clippy"]
targets = ["x86_64-unknown-linux-musl"]A rust-toolchain file can pin channel, components, and targets for a repo.
cargo +stable testThe `+toolchain` shorthand overrides the toolchain for that invocation.
Install rustfmt, Clippy, docs, and source code components.
rustup component listUseful for seeing whether rustfmt or clippy is already available.
rustup component add rustfmtRequired before running `cargo fmt` on some toolchains.
rustup component add clippyRequired before running `cargo clippy`.
rustup component add rust-srcNeeded by some IDEs, tools, and advanced workflows.
rustup docConvenient for offline browsing of docs.
Add platform targets and build for different target triples.
rustup target listIncludes installed status for each target.
rustup target add x86_64-unknown-linux-muslYou must usually add the target before cross-compiling to it.
rustup target add aarch64-apple-darwinUseful when cross-building or producing release artifacts for macOS ARM.
cargo build --target x86_64-unknown-linux-muslTarget-specific artifacts are stored under `target/<triple>/...`.
Build target-specific binaries for packaging instead of running them locally.
cargo build --target aarch64-apple-darwinCross-target binaries usually cannot be executed directly on the host unless compatible.