Build the mental model
Rust is installed through rustup, a toolchain installer that manages far more than a compiler binary — updates, multiple toolchain versions (stable, beta, nightly), and cross-compilation targets are all handled, so switching Rust versions per project needs no reinstall. Cargo, Rust's build tool and package manager, ships with rustup and handles nearly everything a Rust project needs: creating a new project (`cargo new`), compiling it (`cargo build`), running it (`cargo run`), fetching and locking dependency versions, and running tests — much like a Node.js project leans on `npm`, but with the compiler build step built directly in. `cargo new` scaffolds a minimal but complete project: a `Cargo.toml` manifest declaring the package name, version, and dependencies, plus a `src/main.rs` file with a working "Hello, world!" program already in place. Without Cargo you would need to manually track dependency versions, invoke `rustc` with the right flags, and manage build artifacts yourself — Cargo exists specifically to remove that manual bookkeeping. `cargo run` compiles the project (if anything changed) and immediately executes the resulting binary in one command, giving the fastest possible feedback loop while learning.
Connect it to a real scenario
To build the Tutorial Platform's Rust tooling projects (CLI content analyzer, Axum API) in the Projects chapter, prepare this setup on your local machine first — install rustup, then confirm the toolchain with `rustc --version` and `cargo --version`. Start a project directory with `cargo new tutorial-content-tools`, and Cargo auto-generates the `Cargo.toml` and `src/main.rs` starter files. Run every code example throughout the course with `cargo run` and check its output directly in the terminal — repeating this builds fluency reading the Rust compiler's error messages.
Try the working example
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc --version
cargo --version
cargo new tutorial-content-tools
cd tutorial-content-tools
cargo runYou see "Hello, world!" printed in the terminal, confirming a Cargo project compiled and ran successfully.5-minute try-it
Create a new project with `cargo new`, change the println! text in `src/main.rs`, and run `cargo run` again — then run `cargo build` separately and observe what appears in the `target/` folder.
One important caution
Installing Rust from an OS package manager (like `apt install rustc`) instead of rustup — the version often lags and switching or updating toolchains becomes harder.
Running `cargo build` and forgetting the generated binary must be run manually from `target/debug/`, or confusing it with `cargo run` — `cargo run` compiles and executes in one step, while `cargo build` only compiles.
Cargo Book — Getting Started — Rust