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.
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.
Install on your system
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"winget install --id Rustlang.RustupIf 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:
rustc --version
cargo --version
rustup showIf all three commands respond with a version and a stable channel, the
toolchain is ready.
What each tool does
| Tool | What it does | Typical command |
|---|---|---|
| rustup | Installs and updates toolchains and components | rustup update |
| rustc | Compiles a crate into a binary or library | invoked by Cargo |
| Cargo | Manages the project, dependencies, and builds | cargo build |
| rustfmt | Formats code with a single consistent style | cargo fmt |
| Clippy | Applies extra lints for quality and idiomatic code | cargo clippy |
| rust-analyzer | Provides editor support (LSP): autocomplete, live errors | integrates into the editor |
To have rustfmt, Clippy, and rust-analyzer available, add the components to the active toolchain:
rustup component add rustfmt clippy rust-analyzerMost 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:
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 saveIf you maintain projects across several languages, mise can manage the
Rust toolchain alongside the others from a single per-repository
configuration file:
mise use rust@stableIt 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, ortestyet: 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 likebaconshrink the manual cycle of editing and re-running commands.miseis an alternative to rustup only when the project coexists with toolchains from other languages.