Skip to content
Tutorials Center
My learning

Topics

Rust Reference ยท Tools

rustup

Reference for rustup: install and update Rust, choose stable, beta or nightly, pin a version per project, add components and cross-compilation targets.

rustup installs and manages Rust toolchains. A toolchain is one complete set of compiler, standard library, Cargo and friends, identified by a channel (stable, beta, nightly), a specific version such as 1.99.1, or a dated nightly. You can keep several installed and switch between them per directory.

The rustc, cargo and rustfmt commands on your PATH are small proxies; each asks rustup which toolchain applies to the current directory and runs that one. This page is a read-only command reference; the examples parse toolchain names and show compile-time facts about the toolchain that built them.

Terminal
$ rustup update
$ rustup toolchain install nightly
$ rustup component add clippy rustfmt
$ rustup target add wasm32-unknown-unknown

Try it

Rust Reading a toolchain name

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

Rust Facts about the compiling toolchain

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

Syntax

Terminal
rustup <command> [args]
Name Description
rustup update Update all installed toolchains (and rustup itself).
rustup toolchain install <name> Install a channel, version or dated nightly (--profile minimal for a small install).
rustup default <name> Set the toolchain used outside any override.
rustup override set <name> Use a toolchain for the current directory tree.
rustup component add <c> Add clippy, rustfmt, rust-src, rust-analyzer, llvm-tools and so on.
rustup target add <triple> Install the standard library for cross-compiling.
rustup show Show active toolchain, installed targets and why they were chosen.
rustup run <toolchain> <cmd> Run one command with a toolchain. cargo +nightly build is shorthand.
rustup doc Open the offline documentation.
rustup self uninstall Remove everything.

Usage notes

  • Pin a project with a rust-toolchain.toml file in the repository root: [toolchain] channel = "1.99.1", plus optional components and targets. rustup installs it automatically on first use.
  • Selection order, highest first: +toolchain on the command line, RUSTUP_TOOLCHAIN, directory override, rust-toolchain.toml, default.
  • Stable releases come every six weeks, so rustup update once in a while keeps you current.
  • Nightly components can be missing on some days; use rustup toolchain install nightly --allow-downgrade to pick the latest day that has them all.
  • rustup is not the same as cargo install: it manages the compiler, Cargo manages crates. See cargo install.
  • Distribution packages (apt, brew) install Rust without rustup; they cannot add targets or switch channels.
  • Everything lives in ~/.rustup (toolchains) and ~/.cargo (binaries); set RUSTUP_HOME and CARGO_HOME to relocate them.