The Rust toolset has two major components: the compiler (rustc
) and a combined build tool or dependency manager (Cargo). This toolset comes in three frequently released versions:
- Nightly: This is the daily successful build of the master development branch. This contains all the features, some of which are unstable.
- Beta: This is released every six weeks; a new beta branch is taken from nightly. It contains only features that are flagged as stable.
- Stable: This is released every six weeks; the previous beta branch becomes the new stable.
Developers are encouraged to mainly use stable. However, the nightly version enables many useful features, which is why some libraries and programs require it.
To make it easier for people in various platforms to download and install the standard tools, the Rust team developed rustup. The rustup tool provides a way to install prebuilt binaries of the Rust toolset (rustc
and Cargo) easily for your local user. It also allows installing various other components, such as Rust source code and documentation.
The officially supported way to install Rust is to use rustup.rs
:
curl https://sh.rustup.rs -sSf | sh
This command will download the installer and run it. The installer will, by default, install the stable version of the Rust compiler, the Cargo build tool, and the API documentation. They are installed by default for the current user under the .cargo
directory, and rustup will also update your PATH
environment variable to point there.
Here's how running the command should look:
If you need to make any changes to your installation, choose 2. But these defaults are fine for us, so we'll go ahead and choose 1. This is what the output should look like afterwards:
Now, you should have everything you need to compile and run programs written in Rust. Let's try it!