# rustup
`rustup` is the official toolchain installer and version manager for [[Rust]]. It installs and updates the Rust compiler (`rustc`), [[Cargo (Rust)|Cargo]], and the standard library, and lets you switch between release channels (stable, beta, nightly), pin per-project toolchains, and add cross-compilation targets and components like `rustfmt`, `clippy`, and `rust-analyzer`.
It is the recommended way to install Rust on every supported platform. Distro packages (`apt`, `dnf`, `pacman`, [[Homebrew]]) tend to lag behind upstream and don't manage channels; prefer `rustup` unless you have a specific reason not to.
## Common commands
- `rustup show`: show installed toolchains and the active one
- `rustup update`: update all toolchains to the latest version
- `rustup default stable`: set the default channel
- `rustup default stable-msvc`: on Windows, use the MSVC ABI toolchain (default; required for most Microsoft ecosystem libraries) instead of the GNU one
- `rustup toolchain install nightly`: add a nightly toolchain
- `rustup component add rust-analyzer rustfmt clippy`: add common components
- `rustup target add wasm32-unknown-unknown`: add a cross-compilation target
- `rustup self uninstall`: fully remove rustup and all toolchains
## Channels
- `stable`: released every 6 weeks. What most projects target.
- `beta`: the next stable, ~6 weeks out.
- `nightly`: daily builds. Required for some unstable features and tooling.
A project can pin a specific toolchain with a `rust-toolchain.toml` file at its root.
## References
- Official site: https://rustup.rs/
- Book (the rustup user guide): https://rust-lang.github.io/rustup/
- Source code: https://github.com/rust-lang/rustup
- Channels and release process: https://forge.rust-lang.org/infra/channel-layout.html
- Windows MSVC pre-requisites: https://rust-lang.github.io/rustup/installation/windows-msvc.html
## Related
- [[Rust]]
- [[Cargo (Rust)]]
- [[Homebrew]]
- [[Winget]]
- [[Windows Subsystem for Linux (WSL)]]