Skip to Content
Getting StartedInstalling Rust

Installing Rust

Rust is installed and managed through rustup — the official toolchain installer and version manager. It handles everything: compiler, build tools, and even switching between stable, beta, and nightly channels.

Why rustup? Rust ships a new stable release every 6 weeks. rustup makes it trivial to stay up-to-date and switch toolchains for cross-compilation or nightly features.


Prerequisites

Before installing, make sure you have:

  • A terminal / command prompt
  • Internet access
  • A C linker (details per platform below)

Install by Platform

Linux & WSL

Run the following in your terminal:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

This downloads and runs the rustup-init script, which installs the latest stable Rust toolchain.

Linker required. Rust needs a system C linker. Install it for your distro:

# Ubuntu / Debian sudo apt install build-essential # Fedora / RHEL sudo dnf install gcc # Arch sudo pacman -S base-devel

After installation, reload your shell to activate the ~/.cargo/bin path:

source "$HOME/.cargo/env"

Or open a new terminal window.


Verify Installation

Open a new terminal window and run:

rustc --version

Expected output:

rustc 1.85.0 (4d91de4e4 2025-02-17)

Also verify Cargo, Rust’s build tool and package manager:

cargo --version

Expected output:

cargo 1.85.0 (d73d2caf9 2024-12-31)

command not found? Your shell hasn’t picked up the updated PATH. Close and re-open your terminal, or run:

source ~/.cargo/env

On Windows, check that %USERPROFILE%\.cargo\bin is in your system PATH.


What Gets Installed

All tools are placed in ~/.cargo/bin (Unix) or %USERPROFILE%\.cargo\bin (Windows).

    • rustc
    • cargo
    • rustup
    • rustfmt
    • cargo-clippy
    • rust-analyzer (optional)
ToolPurpose
rustcThe Rust compiler — turns .rs source into binaries
cargoBuild system + package manager — your main daily tool
rustupToolchain manager — install channels, components, targets
rustfmtAuto-formatter — enforces community code style
clippyAdvanced linter — catches common mistakes and anti-patterns

Update Rust

Rust ships a new stable release every 6 weeks. Stay current with:

rustup update

To update only the stable channel:

rustup update stable

Install Nightly (Optional)

The nightly channel gives you access to unstable/experimental features:

# Install nightly alongside stable rustup toolchain install nightly # Use nightly for a specific project only rustup override set nightly # Switch your global default rustup default nightly # Switch back to stable rustup default stable

Nightly features can change or be removed at any time. Only use nightly in production if you know what you’re doing. Most projects should stay on stable.


Offline Documentation

rustup ships a local copy of The Rust Book and the standard library API docs:

# Open The Rust Programming Language book rustup doc # Open the standard library API reference rustup doc --std # Open the Cargo book rustup doc --cargo

Uninstall

To completely remove Rust and rustup from your system:

rustup self uninstall

This removes all toolchains, tools, and cleans up PATH entries.


Next Steps

Create your first project

cargo new hello_world cd hello_world cargo run

You should see Hello, world! printed to the terminal.

Read The Rust Book

The best way to learn Rust is the official The Rust Programming Language  book — or open it locally with rustup doc.

Set up your editor

Install rust-analyzer for your editor to get inline type hints, autocomplete, and live error checking:

  • VS Code — search for rust-analyzer in the Extensions panel
  • Neovim — use mason.nvim or install via :LspInstall rust_analyzer

Explore Rust by Example

Rust by Example  is a great companion to the book — every concept shown with runnable code.