Lesson 2

Installation and tooling

Install Rust with rustup, understand what each ecosystem tool does (rustc, Cargo, rustfmt, Clippy, rust-analyzer), and set up continuous feedback.

Level
Intro
Duration
20 min
Updated

Installing is not just “download a binary”

The previous lesson covered what problems Rust is trying to solve. Now it is time to get the environment running: not a lone compiler, but a set of tools that work together from the first minute.

Rust does not ship a single installer with everything bundled in. It ships rustup, a toolchain manager that installs and updates the rest. Understanding that difference avoids confusion later on, when channels (stable, beta, nightly) or multiple projects needing different compiler versions show up.

Step map

  • TASK · no toolchainno rustc available
  • TOOL · official installerchooses channel and target
  • OUTCOME · active toolchainrustc --version works
01 / 04RUSTUP · CHANNEL · TOOLCHAIN

Install on your system

Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

If this is the first time you compile C/C++ on the machine, the installer will ask for the Visual Studio Build Tools (Windows) or the Command Line Tools (macOS); accept them, the linker needs them.

Verify the install on any system:

Check the toolchainmacOS · Linux · PowerShell
rustc --version
cargo --version
rustup show

If all three commands respond with a version and a stable channel, the toolchain is ready.

What each tool does

ToolWhat it doesTypical command
rustupInstalls and updates toolchains and componentsrustup update
rustcCompiles a crate into a binary or libraryinvoked by Cargo
CargoManages the project, dependencies, and buildscargo build
rustfmtFormats code with a single consistent stylecargo fmt
ClippyApplies extra lints for quality and idiomatic codecargo clippy
rust-analyzerProvides editor support (LSP): autocomplete, live errorsintegrates into the editor

To have rustfmt, Clippy, and rust-analyzer available, add the components to the active toolchain:

Add componentsmacOS · Linux · PowerShell
rustup component add rustfmt clippy rust-analyzer

Most modern editors (VS Code, Zed, Neovim with an LSP client) detect rust-analyzer automatically as soon as you open a Cargo project.

Continuous feedback

These commands are not required to get started, but they save friction from the very first real project:

Automate the repetitive partmacOS · Linux · PowerShell
cargo add serde --features derive   # add a dependency
cargo rm serde                      # remove it
cargo clippy --fix                  # apply automatic fixes
bacon                               # re-check the project on every save

If you maintain projects across several languages, mise can manage the Rust toolchain alongside the others from a single per-repository configuration file:

Manage with misemacOS · Linux · PowerShell
mise use rust@stable

It does not replace rustup inside a pure Rust project; it is an extra layer useful when the team already uses mise for other languages.

What this lesson does not cover

  • It is not a step-by-step setup guide for every editor: each one integrates rust-analyzer differently.
  • It does not solve specific installation errors (corporate proxies, network permissions, antivirus). For that, rustup’s own troubleshooting section is usually the best starting point.
  • It does not explain cargo new, build, run, or test yet: that is the next lesson.

What comes next

With the environment installed, the next lesson creates your first Cargo project and walks through the new → check → build → run → test cycle.

Summary

  • rustup installs and manages toolchains (channel + platform); rustc and Cargo arrive together.
  • Cargo is the tool you use daily: it coordinates dependencies, compilation, and reproducibility via Cargo.toml/Cargo.lock.
  • rustfmt, Clippy, and rust-analyzer give style, lint, and type feedback before compiling, not instead of it.
  • cargo add/rm, clippy --fix, and a watcher like bacon shrink the manual cycle of editing and re-running commands.
  • mise is an alternative to rustup only when the project coexists with toolchains from other languages.

Sources