← Back to Rust Course | Chapter 1: Setup & Basics | Lesson 2 of 7

Installing Rust with Rustup

Rustup is a little helper program that downloads and sets up Rust on your computer so you can start coding.

Installing Rustup

Rustup is the official way to install and manage Rust versions. On Linux and macOS, you run a single shell command that downloads and runs the rustup installer, which then installs the rustc compiler, the cargo build tool, and the standard library.

Note: After the installer finishes, open a new terminal or run source $HOME/.cargo/env so the new commands are on your PATH.

Example: Installing Rustup

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

# Windows
# Download and run rustup-init.exe from https://rustup.rs

⚠️ Run this command in your terminal.

Checking the Installed Version

Once installed, you can confirm Rust is ready by asking the compiler and the Cargo build tool for their version numbers. This is the fastest way to verify the install worked before writing any code.

Example: Checking the Installed Version

bash
rustc --version
cargo --version

⚠️ Run this command in your terminal.

Updating Rust

Rust ships new stable releases roughly every six weeks. rustup update fetches the latest stable toolchain so you always have current compiler features and standard library additions.

Example: Updating Rust

bash
rustup update stable

⚠️ Run this command in your terminal.

Confirming From Inside a Program

You can also verify your toolchain works end-to-end by compiling and running an actual Rust program. If it prints correctly, your installation is complete and functional.

Example: Confirming From Inside a Program

markup
fn main() {
    println!("Rust toolchain is installed and working!");
}
Common Mistakes
  1. Trying to install Rust through a system package manager and ending up with an old version instead of using rustup.
  2. Forgetting to restart the terminal (or reload the shell profile) so the cargo and rustc commands are not found.
  3. Not running rustup update periodically, which leaves you on an old compiler missing newer language features.
Chapter Summary
  • Rustup is the official installer and version manager for Rust, covering rustc, cargo, and standard tooling.
  • On Linux/macOS you install it by running a shell script from rust-lang.org; on Windows there is a dedicated installer.
  • rustup update keeps your toolchain current, and rustup show displays what is installed.
  • After installation, rustc --version and cargo --version confirm everything is working.
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.