Getting Started with Rust

danielmwandiki

Daniel

Posted on July 11, 2024

Getting Started with Rust

Rust is a very young and very modern language. It helps you write faster, more reliable software. The goal for Rust is to create a highly concurrent, safe and perfomant system.

Installation

The first step we will download Rust through rustup, a command line tool for managing Rust versions and associated tools.

Installing rustup on Linux or macos

Open your terminal and run the following command
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

The command downloads a script and starts the installation of the rustup tool, which installs the latest stable version of Rust.
If the install is successful the following line will appear:
Rust is installed now. Great!

You will also need a linker, which is a program that Rust uses to join its compiled outputs into one file. If you use Ubuntu, you can install the build-essential package.

Installing rustup on Windows

On windows, go to https://www.rust-lang.org/tools/install and follow the instructions for installing Rust. You will need the MSVC build tools for Visual Studio 2013 or later. When asked which workloads to install, include:

  • “Desktop Development with C++”
  • The Windows 10 or 11 SDK
  • The English language pack component, along with any other language pack of your choosing

Troubleshooting

To check whether you have Rust installed correctly, open a shell and enter this line:
rustc --version

You should see the version number, commit hash, and commit date for the latest stable version that has been released, in the following format:
rustc x.y.z (abcabcabc yyyy-mm-dd)

If you see this information, you have installed Rust successfully! If you don’t see this information, check that Rust is in your PATH system variable as follows.

In Windows CMD, use:
> echo %PATH%

In PowerShell, use:
> echo $env:Path

In Linux and macOS, use:
$ echo $PATH

Updating and Uninstalling

Once Rust is installed via rustup, updating to a newly released version is easy. From your shell, run the following update script:
rustup update

To uninstall Rust and rustup, run the following uninstall script from your shell:
rustup self uninstall

💖 💪 🙅 🚩
danielmwandiki
Daniel

Posted on July 11, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Data Types
learning Data Types

July 12, 2024

Variables and Mutability
learning Variables and Mutability

July 12, 2024

Getting Started with Rust
learning Getting Started with Rust

July 11, 2024

Hello World in Rust
learning Hello World in Rust

July 11, 2024