Basics

Rust Installation

Installing Rust

Rust installation uses rustup to set up the compiler and cargo.

Why Use Rustup?

Rustup is the recommended tool for installing Rust as it manages both the Rust compiler and Cargo, Rust's package manager. It allows you to easily switch between different versions of Rust and manage toolchains for different projects.

Installing Rustup on Windows

To install Rust on Windows, you can use the rustup-init.exe installer. Follow these steps:

  1. Open a terminal or command prompt.
  2. Download and run the installer with the following command:

Once the installation is complete, you may need to restart your terminal for the changes to take effect.

Installing Rustup on macOS and Linux

For macOS and Linux users, installing Rust is straightforward using the curl command. Execute the following in the terminal:

Follow the on-screen instructions to complete the installation. After the installation, ensure your PATH environment variable is configured by running:

Verifying Your Installation

To verify that Rust has been installed correctly, you can check the version of Rust and Cargo using the following commands:

If you see the version numbers without any errors, congratulations! Rust is successfully installed on your system.

Updating Rust

Keeping Rust updated is crucial for accessing new features and security updates. You can update Rust by running:

This command will update the Rust toolchain to the latest stable version.