A Beginner’s Guide to Setting up Rust on Windows.

Learning a new language could be a difficult task especially if it’s completely different from what you’re used to. Setting up Rust is different for different operating systems. Therefore I have prepared a step by step guide to help you install and setup your development environment on windows.

The first step is to install rust on your system from the official rust website. For this article, I’ll be focusing on windows OS. This should download the rustup-init executable file. When you run the .exe it should open up a command line that should instruct you to download the Microsoft visual studio c++ build tools here.

When the download is done run the program to install. After that, you should see options of what you want to install, pick the c++ build tools, accept the defaults then hit install. Note that this might take a while depending on your network speed.

After the step above, run the rustup-init.exe again you should get a different pop-up on the command line because you have satisfied all the requirements to install the program. Hit the enter button then all the components will begin installing. After the installation, you should see a line saying rust is installed.

To get started you need to store cargo’s bin directory inside the environmental path, the setup should have done this automatically but in case it didn't copy the bin directory from the command line press enter to continue this should bring you back to windows then search ‘env’ on your windows. Search results for ‘edit the environment variables’ should pop-up select that. Click on environment variables located at the bottom right, select path , and hit edit, you should see the cargo bin already added but if it wasn't paste the bin directory we copied earlier then save all settings.

We’re almost done, open a command line and type rustup if it was correctly installed you should see a list of subcommands.

This is what you should see. This means it was installed successfully.

Open vscode or any IDE you use that supports Rust and download the rust extension, this enables the IntelliSense, text completion, coloring, etc.

Now you’re ready to become a rustacean, open your command line, choose your preferred directory , and type in cargo new ‘any name of your choosing’ press enter, this should create a new folder for you.

if you get this then you created it successfully

then open the folder with vscode or any other IDE you use.

This should be what you’re seeing at this point(if vscode is your preferred IDE). By default, all new files you create already have a code block to print a string to the terminal the default string is “Hello, world!”. To run your code open a terminal and make sure that it is in the same directory as your folder and type in cargo run this should compile and run your code.

and that's a wrap. you're officially one of us. May the Rust be with you :).

LEARNING RESOURCES.

I’ll see you in my next article hopefully :).

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
David Ekete

Backend Engineer and JavaScript / TypeScript Developer with a growing interest in exploring and contributing to emerging technology.