Windows

  1. Visit the official Rust website and download the installer.
  2. Run the installer and follow the on-screen instructions.
  3. Rustup, the Rust installer, will manage the installation and updates for you.

To verify your installation, open Command Prompt or PowerShell and type:

  rustc --version
  

macOS

  1. Open a terminal window.

  2. Run the following command to download and run the installer script:

  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  
  1. Follow the on-screen instructions. Rustup will download the necessary files and set up the environment.

To ensure Rust is installed correctly, open a new terminal window and type:

  rustc --version
  

Linux (using yum for CentOS/RHEL)

Rust is not typically available directly via yum due to the rapid pace of Rust’s development. It’s recommended to install Rust using rustup:

  1. Install rustup:
  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  
  1. Follow the on-screen instructions to complete the installation.

  2. Add Rust to your PATH:

  source $HOME/.cargo/env
  
  1. Verify Rust installation:
  rustc --version
  

Linux (using apt for Debian/Ubuntu)

  1. Ensure curl is installed:
  sudo apt update
sudo apt install curl
  
  1. Install rustup:
  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  
  1. Follow the on-screen instructions to complete the installation.

  2. Add Rust to your PATH:

  source $HOME/.cargo/env
  
  1. Verify Rust installation:
  rustc --version