Rust - Environment Setup


Installation of Rust is made easy through rustup, a console-based tool for managing Rust versions and associated tools.

Installation on Windows

Let us learn how to install RUST on Windows.

  • Installation of Visual Studio 2013 or higher with C++ tools is mandatory to run the Rust program on windows. First, download Visual Studio from here VS 2013 Express

  • Download and install rustup tool for windows. rustup-init.exe is available for download here − Rust Lang

  • Double-click rustup-init.exe file. Upon clicking, the following screen will appear.

Installation on Windows
  • Press enter for default installation. Once installation is completed, the following screen appears.

Installation completed
  • From the installation screen, it is clear that Rust related files are stored in the folder −


The contents of the folder are −

rustc.exe // this is the compiler for rust
  • Cargo is the package manager for Rust. To verify if cargo is installed, execute the following command −

C:\Users\Admin>cargo -V
cargo 1.29.0 (524a578d7 2018-08-05)
  • The compiler for Rust is rustc. To verify the compiler version, execute the following command −

C:\Users\Admin>cargo -V
cargo 1.29.0 (524a578d7 2018-08-05)

Installation on Linux / Mac

To install rustup on Linux or macOS, open a terminal and enter the following command.

$ curl -sSf | sh

The command downloads a script and starts the installation of the rustup tool, which installs the latest stable version of Rust. You might be prompted for your password. If the installation is successful, the following line will appear −

Rust is installed now. Great!

The installation script automatically adds Rust to your system PATH after your next login. To start using Rust right away instead of restarting your terminal, run the following command in your shell to add Rust to your system PATH manually −

$ source $HOME/.cargo/env

Alternatively, you can add the following line to your ~/.bash_profile −

$ export PATH="$HOME/.cargo/bin:$PATH"

NOTE − When you try to compile a Rust program and get errors indicating that a linker could not execute, that means a linker is not installed on your system and you will need to install one manually.

Using Tutorials Point Coding Ground for RUST

A Read-Evaluate-Print Loop (REPL) is an easy to use interactive shell to compile and execute computer programs. If you want to compile and execute Rust programs online within the browser, use Tutorialspoint Coding Ground.