How to Install the Rust Language

Retrieve 'rustup-init'., Select your installation type., Wait for the installation to complete., Test your Rust installation., Try creating a project using Cargo.

5 Steps 2 min read Medium

Step-by-Step Guide

  1. Step 1: Retrieve 'rustup-init'.

    Most developers prefer to use rustup to install Rust as it is the easiest method of doing so.

    With it, people using Unix will be able to install Rust using just one command, while Windows users simply have to run an executable file.

    For people running Unix or Linux, run curl https://sh.rustup.rs
    -sSf | sh to download and run the installer.

    Once downloaded, the installation will begin immediately.

    For people running Windows or another platform, you can find the installer for your device on the official website.
  2. Step 2: Select your installation type.

    Once the installer has been run, you will be presented with three options: proceed with, customize or cancel the installation.

    The first option will go forward with the installation using all of the default options.

    If you choose to customize the installation, you will be presented with the following three questions.

    What is your default host triple? What default toolchain should be used? Here, you can choose between stable, beta and nightly.

    Should the PATH variable be modified? If you choose yes, Rust will be added to the PATH automatically, thus eliminating the need to do so yourself.

    By pressing enter, you can skip a question and leave it with its default value. , After the installation is finished, you will be presented with the message "Rust is installed now.

    Great!".

    This will tell you if the installation was successful., To test to see if your Rust installation was successful, open your terminal and type rustc
    -V.

    This command should print out the version of rustc you are using.

    If you get an error stating that the command was not found, you may need to add the Cargo bin directory to the PATH manually.

    This folder should be located at ~/.cargo/bin on Linux systems., As a final test, attempt to create a new Rust project using Rusts package manager, Cargo.

    To do this, run cargo new
    --bin in your terminal.

    If all goes well, you should have a new directory with the specified name containing a configuration file and a directory titled "src"

    proving everything is working as it should.
  3. Step 3: Wait for the installation to complete.

  4. Step 4: Test your Rust installation.

  5. Step 5: Try creating a project using Cargo.

Detailed Guide

Most developers prefer to use rustup to install Rust as it is the easiest method of doing so.

With it, people using Unix will be able to install Rust using just one command, while Windows users simply have to run an executable file.

For people running Unix or Linux, run curl https://sh.rustup.rs
-sSf | sh to download and run the installer.

Once downloaded, the installation will begin immediately.

For people running Windows or another platform, you can find the installer for your device on the official website.

Once the installer has been run, you will be presented with three options: proceed with, customize or cancel the installation.

The first option will go forward with the installation using all of the default options.

If you choose to customize the installation, you will be presented with the following three questions.

What is your default host triple? What default toolchain should be used? Here, you can choose between stable, beta and nightly.

Should the PATH variable be modified? If you choose yes, Rust will be added to the PATH automatically, thus eliminating the need to do so yourself.

By pressing enter, you can skip a question and leave it with its default value. , After the installation is finished, you will be presented with the message "Rust is installed now.

Great!".

This will tell you if the installation was successful., To test to see if your Rust installation was successful, open your terminal and type rustc
-V.

This command should print out the version of rustc you are using.

If you get an error stating that the command was not found, you may need to add the Cargo bin directory to the PATH manually.

This folder should be located at ~/.cargo/bin on Linux systems., As a final test, attempt to create a new Rust project using Rusts package manager, Cargo.

To do this, run cargo new
--bin in your terminal.

If all goes well, you should have a new directory with the specified name containing a configuration file and a directory titled "src"

proving everything is working as it should.

About the Author

M

Megan Campbell

A passionate writer with expertise in lifestyle topics. Loves sharing practical knowledge.

104 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: