In this tutorial you will learn about the Rust Installation and its application with practical example.
Rust Installation
Installing Rust In Windows
In order to setup Rust development environment you need to have Rust installed, so if you don’t have it installed, check the following instruction to get Rust installed. If you’ve already have installed Rust Language in your system, you can skip this part.
Note:- Installation of visual studio with C++ tools is mandatory to run the rust program.
Step 1:- Download the Rust Windows Installer from the official Rust Language website, link given below –
1 |
https://www.rust-lang.org/en-US/other-installers.html |
Step 2:- Run the installer (the .exe file you downloaded in the previous step.)
Step 3:- Follow the installation to install Rust.
Step 4:- After the installation, PATH of Rust automatically added to PATH environment variables in advanced system properties.
Step 5:- Now, lets open the terminal and run the following command in order to verify the Rust installation.
1 |
rustc --version |
Rust Installation in Linux and macOS
In Linux use the following command to download and install rustup, this will install the latest version of Rust.
1 |
curl https://sh.rustup.rs -sSf | sh |
After the successful installation following message will be displayed on the terminal –
1 |
Rust is installed now. Great! |
The Rust path is automatically added to system path after your next login. But, if you want to run Rust directly after installation without restarting the terminal, then use the following command to manually add path to your system PATH.
1 |
source $HOME/.cargo/env |
Once the Rust Installation is done, you would additionally require a linker to run your Rust program, otherwise you will get the a linker error. You will also require C compiler as some of the Rust packages are dependent on C.
Rust Updating
Run the following command to update to the latest version of Rust –
1 |
rustup update |
Uninstalling Rust
Run the following command to uninstall the Rust –
1 |
rustup self uninstall |
gj