Installing Visual Studio Code on Linux Mint 21 & 20
If you want a slick, feature‑rich editor that works out of the box on Mint, VS Code is your go‑to. This article walks through the most reliable ways to get it up and running without digging into endless dependency messes.
Why the .deb route is usually best
Microsoft ships a ready‑made Debian package. It pulls in only what you need and stays in sync with future releases via an official repository, so upgrades are automatic. I’ve seen people try to install from the generic “apt” command and end up with broken packages because Mint’s stock repositories don’t know about VS Code.
Step 1: Add Microsoft’s GPG key
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/
Why this matters: The key lets APT verify the package’s authenticity. Skipping it just invites a warning every time you install.
Step 2: Register the VS Code repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
Why this matters: Without the repo entry, apt will look only in Mint’s default sources and never find VS Code.
Step 3: Update apt cache and install
sudo apt update sudo apt install code
That’s it. You can launch “Visual Studio Code” from the menu or run code in a terminal. Future updates will be fetched automatically with your regular system upgrades.
Alternative: Snap package (quick & lightweight)
If you prefer snaps, just:
sudo snap install code --classic
The Snap version stays isolated and is updated by the Snap daemon. I’ve used this on a Mint 20 machine to keep VS Code separate from my main packages, which saves me from accidental dependency conflicts.
Common hiccup: “Could not resolve host” after upgrading
I once saw a user run into a DNS error when trying apt update right after installing the repo. The fix was simple: clear the DNS cache or reboot. Once resolved, VS Code installed cleanly.
Tip: Keep the extension market healthy
After installation, open VS Code and hit Ctrl+Shift+X to browse extensions. I recommend “Python” for scripting and “GitLens” if you work with version control. Just remember that installing too many heavy extensions can slow down startup time.