Install Visual Studio Code

Completed

As an aspiring Rust developer, you need to write Rust source code into text files.

A Rust source file is a text file with a .rs file extension that you type all your Rust code into. After you save the code in your text file, you use the Rust compiler (rustc) or Cargo to compile your code into a program.

Tools to write Rust code

You typically write Rust syntax in a text file and save it to your local hard drive. You can write code by using a simple text file editor, like Notepad in Windows. Notepad edits ASCII text, a standard text file format.

Tip

Avoid any text editor that includes formatting options, like bold, underline, or italics, or any other program that has word-processing features. For example, don't write code in Microsoft Word or TextEdit on macOS. These programs have additional formatting instructions that the Rust compiler won't understand.

Although you can use a text editor, you probably want to use a tool that's better suited for the unique challenges of writing code. There are many options, but many developers rely on Visual Studio Code for this purpose. Visual Studio Code is free and available on Windows, macOS, and Linux. It has many features that make it easy to navigate code, no matter which programming language you want to work with.

Pick one of the following installation procedures, based on your operating system.

Install Visual Studio Code on Windows

Here's how to download the installer from the Visual Studio Code website.

Step 1 - Download the installer

Go to the Visual Studio Code download page. The webpage displays logos for Windows, Linux, and Mac.

Download the Windows installer. Most browsers give you the option to save the file to your local computer (usually in your Downloads folder), or to immediately run the installer file.

Step 2 - Start the installer

If you downloaded the installer, you might need to open File Explorer and go to your Downloads folder, or wherever your web browser saved the installer file.

Double-click the installer file to start the installation process.

Step 3 - Start Visual Studio Code

After the installation is done, you can immediately start Visual Studio Code.

Install Visual Studio Code on macOS

Here's how to download and install Visual Studio Code.

Step 1 - Download Visual Studio Code

Go to the Visual Studio Code download page.

The webpage displays logos for Windows, Linux, and Mac. Download the Mac version. Most browsers give you the option to save the file to your local computer (usually in your Downloads folder), or to immediately run the file.

Move the file to the Applications folder before you open it, as described in the next step.

Step 2 - Move the app from the Downloads folder to the Applications folder

Open Finder. Drag the Visual Studio Code file from the Downloads stack on the Dock to the Applications folder in Finder.

Step 3 - Start Visual Studio Code from the Applications folder

Double-click the Visual Studio Code app from the Applications folder.

Note

You might see a warning that Visual Studio Code can't be opened because Apple can't check it for malicious software. If that happens, select OK to dismiss the message. Then right-click Visual Studio Code in the Applications folder, and select Open menu. If you select this option, Visual Studio Code should open without any further issues.

Install Visual Studio Code on Linux

Here's how to download the installer from the Visual Studio Code website. You can also install it through your terminal by using a package manager, like APT or YUM. For more information about using a package manager, see Visual Studio Code on Linux.

Step 1 - Download the installer

Go to the Visual Studio Code download page.

The webpage displays logos for Windows, Linux, and Mac. Under the Linux logo, select either the .deb installer (for Debian or Ubuntu distributions) or the .rpm installer (for Red Hat, Fedora, or SUSE distributions).

Step 2 - Start the installer

If you downloaded the installer, you might need to open your file explorer and go to your Downloads folder, or wherever your web browser saved the installer file.

Double-click the installer file to start the installation. On Ubuntu and Fedora, double-clicking the installer opens the Software application. This application provides a convenient way to view details about the application you're about to install. In this case, select Install.

You might be asked to authenticate by using your account password.

After a moment, Visual Studio Code should be installed.

Step 3 - Start Visual Studio Code

The instructions for installing Visual Studio Code differ, depending on which desktop environment your distribution of Linux uses. Search through the list of applications installed on your computer.

For example, if your distribution uses the GNOME desktop, locate the Show Applications icon (a grid of dots) docked on the left side of the screen, usually near the bottom. This icon opens a full-screen list of all applications installed on your system. The Visual Studio Code icon should be included in the list.

Select the Visual Studio Code icon to start the application.

Check your knowledge

Answer the following questions to see what you've learned. Choose one answer for each question, and then select Check answers.

1.

What two ways can you use to compile a Rust program?