Home  Rust   How to inst ...

How to install rust in Windows, Mac and Linux

Installing Rust is a straightforward process on various operating systems, thanks to the rustup toolchain installer. Here's how you can install Rust on Windows, macOS, and Linux.

Installing Rust on Windows

  1. Download Rustup Installer:

  2. Run the Installer:

    • Execute the downloaded rustup-init.exe file.
    • Follow the on-screen instructions to install Rust. The default options are generally recommended.
  3. Set Up the Environment:

    • After installation, open a new Command Prompt or PowerShell window.
    • Verify the installation by running:
      rustc --version
      

Installing Rust on macOS

  1. Install Homebrew (if not already installed):

    • Open the Terminal application.
    • Install Homebrew by running:
      /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
      
  2. Install Rust Using Rustup:

    • Use the following command to download and run the Rustup installation script:
      curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
      
    • Follow the on-screen instructions. The default options are generally recommended.
  3. Set Up the Environment:

    • Restart the Terminal or run source ~/.cargo/env to update the current session's environment variables.
    • Verify the installation by running:
      rustc --version
      

Installing Rust on Linux

  1. Install Required Dependencies:

    • Open a terminal.
    • Ensure you have the required tools for building Rust projects:
      • On Debian-based systems (like Ubuntu):
        sudo apt update
        sudo apt install build-essential curl
        
      • On Red Hat-based systems (like Fedora):
        sudo dnf groupinstall 'Development Tools'
        sudo dnf install curl
        
  2. Install Rust Using Rustup:

    • Use the following command to download and run the Rustup installation script:
      curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
      
    • Follow the on-screen instructions. The default options are generally recommended.
  3. Set Up the Environment:

    • Restart the terminal or run source ~/.cargo/env to update the current session's environment variables.
    • Verify the installation by running:
      rustc --version
      

Additional Configuration

Published on: Jun 19, 2024, 10:58 PM  
 

Comments

Add your comment