To get started with Rust, you need two things: rustc
, the command-line compiler, and cargo
, Rust’s package manager.
This tutorial assumes you’ll be using Windows and not the Windows Subsystem for Linux (WSL). As such, I recommend you use Visual Studio Code or a similar IDE to help with IntelliSense and other development goodies.
Install Rust
On Windows, the easiest way to do this is to run the installer file from the offical Rust website.
Head there, then download and run the rustup-init.exe
file:
Once you open it, you’ll be met with the installer options:
Go ahead and just press [Enter]
to select the default.
You’ll see a bunch of downloads. This is good. When it stops, you’ll be told that Rust is installed and that your PATH variable is about to be modified:
Just hit [Enter]
again, and the window will disappear.
Verify Installation
At this point, the Rust development tools–rustc
and cargo
–are in your path. To verify that, open a Command Prompt window and type in:
rustc --version
You should see something like this:
To open the Command Prompt, hit the Windows key and type cmd
. You should see the Command Prompt come up in the Best Match area:
Click on it to open it.
Next, verify that Rust’s package manager, cargo
, is working by running the following:
cargo --version
If either the compiler or package manager produces an error with the above --version
invocations, please try reinstalling Rust.
Otherwise, you’re all set!