Lesson 2 / 825%

Lesson 2

Installing VS Code

15 min

Download and install VS Code on Windows, macOS or Linux.

Definition

Installing a piece of software means copying its files to your computer and configuring it so that it can be launched. In this lesson, installing VS Code means downloading the program from the official website, installing it for your operating system (Windows, macOS or Linux), then checking that it works correctly.

Before you start

VS Code is lightweight software, so the requirements are very modest. It runs on almost every recent computer: Windows 10 or 11, a recent version of macOS, or a common Linux distribution (Ubuntu, Debian, Fedora...). Just allow a few hundred megabytes of disk space and an internet connection for the download. No special privileges are needed in most cases, although some installations "for all users" ask for an administrator password.

Downloading VS Code

VS Code should be downloaded exclusively from the official websitecode.visualstudio.com. The site automatically detects your operating system (Windows, macOS or Linux) and offers you the right installation file through a big download button. Avoid downloading VS Code from a third-party site: it is always better to go through the official source to be sure of getting a safe, up-to-date version.

You will sometimes see two variants: the Stable version, the one everyone uses and the one we invite you to choose, and theInsiders version, an experimental edition updated daily, intended for curious users who want to test new features early. For learning, the stable version is far preferable, because it is more reliable.

Installing on Windows

Once the .exe file is downloaded, double-click it to launch the installation wizard. Accept the license agreement, then leave the default options. It is strongly recommended to check the following boxes when they are offered:

  • Add to PATH: lets you launch VS Code directly from a terminal by simply typing code.
  • Open with Code (right-click menu): adds an entry to the context menu of the file explorer to open any folder directly in VS Code.
  • Register Code as an editor for supported file types: makes it easy to open code files with a double-click.
  • Create a desktop icon: handy for finding VS Code in one click, especially at the beginning.

Then click "Install", then "Finish". VS Code launches automatically at the end of the installation.

If Windows shows a security warning (SmartScreen) when you launch the file, check that the publisher shown is indeed Microsoft Corporation, then allow it to run. You can also choose between the "User Installer" version, which installs only for your account without administrator rights, and the "System Installer" version, which installs for all users of the computer.

Installing on macOS

On a Mac, the download provides a .zip archive. Unzip it (double-click if it doesn't happen automatically), then drag and drop the resulting Visual Studio Code application into your Applications folder. You can then launch it from Launchpad or Spotlight (shortcutCmd + Space, then type "Visual Studio Code").

To be able to launch VS Code from the terminal with the code command, open VS Code, press Cmd + Shift + P to open the Command Palette, then search for and select "Shell Command: Install 'code' command in PATH".

On first launch, macOS may ask you to confirm that you want to open an application downloaded from the internet: click "Open". If you forget to move the application to the Applications folder, VS Code will still work, but automatic updates may not apply correctly.

Installing on Linux

On Debian/Ubuntu-based distributions, the simplest way is to download the.deb package and then install it with the following command from the download folder:

terminal
sudo apt install ./code_*.deb

On Fedora, Red Hat or CentOS, an .rpm package is also available. Some distributions also offer VS Code directly in their package manager or via Flatpak/Snap.

Installing the package also sets up the code command in your terminal, with no extra steps. It also adds Microsoft's official repository, which lets you receive updates at the same time as those of the rest of your system.

Good to know

VS Code updates itself automatically in most cases (a notification appears at the bottom right when an update is ready). You can also check manually via the menu Help → Check for Updates.

First launch

On first launch, VS Code displays a "Welcome" screen with shortcuts to tutorials, a choice of color theme and links to the documentation. You can close this tab at any time — it remains accessible later from the menuHelp → Welcome.

Take the opportunity to choose a theme you like: a dark theme is easier on the eyes during long sessions, while a light theme can be more pleasant in broad daylight. You can change it at any time, with no consequence for your code.

VS Code may also offer to install extensions or to change the interface language: accept it if you prefer another language, but keep in mind that most online resources use the English names of the menus.

Checking that the installation succeeded

The simplest way to check your installation is to open a terminal (Command Prompt or PowerShell on Windows, Terminal on Mac and Linux) and type the command below. If everything is correct, the terminal displays several lines: the VS Code version number, an internal identifier and the architecture of your processor.

terminal
code --version

You can also try the code . command: the dot means "the current folder". VS Code then opens directly on the folder where your terminal is located, which will be very handy for starting to work on a project.

What if I can't install anything?

If you are using a shared or locked-down computer (school, company, internet café), there is an online version of VS Code, accessible from your browser at vscode.dev. It does not offer all the features of the installed version (the integrated terminal, in particular, is not available there), but it remains very useful in a pinch and for trying out the editor.

If something goes wrong

  • The code command is not found: close and reopen your terminal, because it must be restarted to pick up the newPATH. On Mac, check that you did run the install command from the palette.
  • The download fails: check your connection, then try again from the official website with another browser if needed.
  • The installation is stuck: close other programs, run the installer again, and check that you have enough free disk space.

Exercise

Download and install VS Code on your computer by following the steps in this lesson. Once the installation is finished, open a terminal and typecode --version to check that the command works and to display the installed version.