Introduction to Rust

Installing Rust with rustup

rustup is the universal toolchain installer for Rust across macOS, Linux, Windows, and BSD. Rather than installing a single static version of the compiler, rustup sets up a user-local environment in your home directory (~/.cargo and ~/.rustup) that manages compiler releases, standard libraries, and developer tools.

Cross-Platform Installation Methods

The installation method for rustup depends on your operating system:

Operating System Recommended Installation Method Prerequisite
macOS curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh Xcode Command Line Tools (xcode-select --install)
Linux / BSD / WSL curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh C compiler and linker (build-essential on Debian/Ubuntu, gcc on Fedora/Arch)
Windows Download and run rustup-init.exe from https://rustup.rs Visual Studio C++ Build Tools (Desktop development with C++)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Choosing an Installation Profile

When installing via rustup, the profile setting determines which components are downloaded for each toolchain:

Profile Name Installed Components Best For
minimal rustc, cargo, rust-std Automated CI containers and build servers where docs and linters are not needed
default rustc, cargo, rust-std, rustfmt, clippy, rust-docs Standard local development on workstations and laptops
complete All components available in the toolchain (including rust-src, llvm-tools, miri) Advanced compiler or tooling development (use with caution; some nightly components occasionally fail to build)

Set or change your active profile at any time:

rustup set profile default

Directory Structure Created by rustup

rustup never requires sudo or administrator privileges because all files are installed inside two directories under your user account:

Home Directory (~)
├── .cargo/                       (Override with $CARGO_HOME)
│   ├── bin/                      <-- Added to PATH: contains `rustc`, `cargo`, `rustup` shims
│   ├── env                       <-- POSIX shell script that exports PATH
│   ├── config.toml               <-- Optional global Cargo configuration
│   └── registry/                 <-- Downloaded crate source cache from crates.io
└── .rustup/                      (Override with $RUSTUP_HOME)
    ├── settings.toml             <-- Tracks default toolchain and profile
    └── toolchains/               <-- Full toolchain installations (side-by-side)
        ├── stable-aarch64-apple-darwin/
        └── nightly-aarch64-apple-darwin/
Environment Variable Default Location (Unix / macOS) Default Location (Windows) Purpose
CARGO_HOME ~/.cargo %USERPROFILE%\.cargo Stores proxy binaries (bin/) and downloaded crate caches
RUSTUP_HOME ~/.rustup %USERPROFILE%\.rustup Stores installed toolchains and rustup settings

Verifying the Installed Toolchain

After installation and loading ~/.cargo/env (source "$HOME/.cargo/env"), verify that the compiler, package manager, and toolchain manager are active:

rustc --version
cargo --version
rustup --version
rustc 1.85.0 (4d91de4e4 2025-02-17)
cargo 1.85.0 (d73d2caf9 2024-12-31)
rustup 1.28.1 (f9edccde0 2025-03-05)

Keeping Rust Up to Date and Uninstalling

Because Rust releases a new stable version every six weeks, updating your installation requires only a single command:

rustup update

rustup update checks the official release manifest, downloads any newer versions of your installed channels (stable, beta, nightly), and preserves your installed components (clippy, rustfmt, rust-analyzer) and cross-compilation targets.

To remove the entire Rust installation cleanly from your system:

rustup self uninstall