Setup Rust on Windows

Setup Rust on Windows

Rust is a famous systems programming language that prioritises performance, dependability, and security. Setting up a Rust development environment on Windows can be difficult, but with the methods below, you should be up and running in no time.

  • Install Rustup

The suggested method for installing Rust on Windows is via Rustup. It is a command-line utility for installing and managing various Rust versions. To install Rustup, go to the Rust website and start the installer (https://www.rust-lang.org/tools/install). Make certain to use the default installation choices.

  • Install Visual Studio Build Tools

Because Rust depends on C++ build tools, you must install Visual Studio Build Tools. The Visual Studio build tools are available for distribution from the Visual Studio website (https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019). Select the "Build Tools for Visual Studio 2019" choice to install the C++ development components. Make certain that the choice to install the C++ build tools is selected.

  • Install a Rust IDE or Text Editor

Rust is a text-based language, so you can use any text editor or IDE that supports Rust. Some popular choices include Visual Studio Code (https://code.visualstudio.com/) with the Rust extension (https://marketplace.visualstudio.com/items?itemName=rust-lang.rust), IntelliJ IDEA (https://www.jetbrains.com/idea/) with the Rust plugin (https://plugins.jetbrains.com/plugin/8182-rust), and Atom (https://atom.io/) with the Rust package (atom.io/packages/language-rust).

  • Configure Your Environment Variables

To use Rust from the command line, add the Rust bin directory to the PATH environment variable on your machine. To accomplish this, launch the Control Panel, go to System > Advanced System Settings > Environment Variables, and add the following to the PATH variable:

C:\Users\{YOUR USERNAME}\.cargo\bin

Replace {YOUR USERNAME} with your Windows username.

  • Verify Your Rust Installation

To ensure that Rust is properly installed, start a command prompt or terminal window and type:

rustc --version

This should show the Rust version you loaded. You can also check for the presence of Cargo (Rust's package manager) by typing:

cargo --version
  • Create Your First Rust Project

Open a command window or console and enter the following commands to start a new Rust project:

cargo new my_project

Replace my_project with your project's name. This will generate a new Rust file in the directory my_project. You can then browse to this directory and begin editing the files in your project.


Congratulations! You have successfully installed a Rust programming environment on Windows. With Rust, you can now begin creating fast, safe, and dependable system code.

Did you find this article valuable?

Support SoNiC-HeRE by becoming a sponsor. Any amount is appreciated!