Installing the Rust toolchain

A toolchain is a set of specifically versioned programs, that allow us to complete common development tasks.

While the Rust Programming Language does have a standalone compiler (rustc, ie rust compiler), the primary way programmers install Rust is through Rust's official toolchain installer, rustup.

The Rustup installer installs rustup itself, as well as as the stable version of rustc and cargo (the primary rust package manager). It also installs helpful development tools such as clippy: a helpful linter, and Rustfmt - a tool for automatically formatting rust code. If you're interested in learning more about how Rustup works, checkout the rustup documentation.

To install Rustup, follow the instructions on the website. It should look something like:

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

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

... lots of output

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
> 1

... lots of output

info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.59.0 (9d1b2106e 2022-02-23)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env

source $HOME/.cargo/env
rustc --version
rustc 1.62.0 (a8314ef7d 2022-06-27)
cargo --version
cargo 1.62.0 (a748cf5a3 2022-06-08)
note: since you live in the future, your version may be more recent

Ta-da! You now have a Rust toolchain installed locally!

Next up, you will want to setup your editor to work nicely with rust. This course does not require you use any particular editor (you can use notepad or even gedit). But, to make your life easier, you should setup a good editor with rust-analyzer.

The home computing docs have some suggestions - namely VSCode and Neovim.