Installing VSCode

Set up your development environment for microcontrollers

Installing VSCode

This tutorial explains how to install Visual Studio Code and PlatformIO to program Arduino, ESP32, STM32 and many other microcontrollers.

Duration :
Difficulty :
Documentation completed: 100% 100
Created by:  Alban Petit

Introduction

Visual Studio Code (VSCode) is a lightweight, powerful code editor developed by Microsoft.

This tutorial guides you through the complete installation on Windows, macOS and Linux.

Installing Visual Studio Code

Installing on Windows

Step 1: Download

Go to the official VSCode website at https://code.visualstudio.com/. Click the download button for Windows. The installation file (VSCodeUserSetup-x64.exe) will be downloaded.

Step 2: Run the installer

Double-click the downloaded file to start the installation. Accept the licence terms.

Step 3: Installation options

Tick the following (recommended) options:

  • Add ‘Open with Code’ action to the file context menu
  • Add ‘Open with Code’ action to the directory context menu
  • Add to PATH (important for PlatformIO)
  • Create a desktop icon

Click Next then Install.

Step 4: Finishing

Once the installation is complete, tick Launch Visual Studio Code and click Finish. VSCode starts for the first time.

Installing on macOS

Step 1: Download

Go to https://code.visualstudio.com/. Download the version that matches your processor:

  • Apple Silicon (M1, M2, M3, M4): Download .zip
  • Intel: Download .zip

Step 2: Installation

  1. Double-click the downloaded .zip file to extract it
  2. Drag and drop Visual Studio Code.app into the Applications folder
  3. Open the Applications folder and double-click Visual Studio Code

Step 3: First launch

If macOS shows a security message, go to System Settings > Privacy & Security, then allow Visual Studio Code to run.

Step 4: Install 'code' in the PATH

To use VSCode from the terminal (useful for PlatformIO):

  1. Open VSCode
  2. Press Cmd+Shift+P to open the command palette
  3. Type shell command
  4. Select Shell Command: Install ‘code’ command in PATH
  5. Confirm with Enter

Installing on Linux

Download and install the .deb package from the official website:

  1. Go to https://code.visualstudio.com/
  2. Download the .deb file
  3. Install it with: sudo apt install ./code_*.deb

Or through the official repository:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code

Fedora / Red Hat / CentOS

Install the RPM package:


sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\\nname=Visual Studio Code\\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\\nenabled=1\\ngpgcheck=1\\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

Then:


sudo dnf check-update
sudo dnf install code

Arch Linux

VSCode is available in the AUR:

yay -S visual-studio-code-bin

Or use Snap: sudo snap install code --classic

  USB permissions on Linux

On Linux, you will have to configure USB permissions to program microcontrollers. This is explained further on, in the dedicated section.

Checking the VSCode installation

Check that VSCode works

Start Visual Studio Code. You should see:

  • The main window with the welcome page
  • The activity bar on the left (Explorer, Search, Extensions…)
  • An empty editor in the centre

If you see this interface, VSCode is correctly installed!

Here are a few useful settings to improve your development experience.

Useful VSCode extensions

Install these extensions to improve your productivity:

  • C/C++ (Microsoft): IntelliSense for C/C++
  • Better C++ Syntax: Better syntax highlighting
  • Bracket Pair Colorizer 2: Colours matching pairs of brackets

Resources and going further

VSCode Documentation

  Next steps

Now that VSCode is installed, you are ready to install PlatformIO and then build your embedded projects! Explore the examples included, try different boards, and do not hesitate to read the documentation.

Need help?