VS Code

How to Install VSCode on Ubuntu: Step-by-Step

How to Install VSCode on Ubuntu: Step-by-Step

Most people installing VSCode on Ubuntu end up on Microsoft’s apt repository, and that’s the route I’d pick too. It takes five steps, and after that the editor updates through apt like any other package on the system.

You can also grab the .deb package or the snap. The .deb isn’t really a one-off install, though. Microsoft’s installer prompts to add the same apt repository and signing key, which enables auto-updates through apt (Microsoft VS Code documentation, 2026). Say yes and you end up in the same place.

The snap updates itself in the background through snapd. The repository serves builds for amd64, arm64 and armhf.

What Do You Need Before Installing VSCode on Ubuntu?

Not much. Sudo rights on your account, a terminal and a working internet connection cover most of it. The one thing worth checking is your CPU, since the Microsoft repository only covers amd64, arm64 and armhf.

If you want a quick primer on the editor first, this explainer on what VSCode actually is covers it.

  • Sudo access (every install method below needs it)
  • A terminal. Ctrl+Alt+T opens one on a default Ubuntu desktop.
  • The wget and gpg packages, but only if you go the apt repository route

Supported Ubuntu releases and CPU architectures

Microsoft’s requirements page lists Ubuntu Desktop 20.04 as the Debian-based baseline, so 22.04, 24.04 and 26.04 all sit above it (Microsoft VS Code documentation, November 2026).

The support windows matter more than the baseline. Ubuntu 26.04 LTS shipped on April 23, 2026 and gets standard security maintenance until May 2031 (Canonical). Standard maintenance for 22.04 ends in May 2027 and for 24.04 in May 2029. If you’re setting up a fresh dev box anyway, I’d just go with 26.04.

Architecture is where people occasionally get caught out. Microsoft’s repository lists amd64, arm64 and armhf. Ubuntu also builds for s390x, riscv64 and ppc64el, and the repository has no entry for those three.

Check your own architecture with dpkg --print-architecture before you add anything.

Hardware and library minimums

Microsoft recommends a 1.6 GHz processor and 1 GB of RAM, with a download under 200 MB and a disk footprint under 500 MB. Those are general figures from the requirements page, not Linux-specific ones.

The real floor on Linux is the C library. You need GLIBC 2.28 or later and GLIBCXX 3.4.25 or later. Ubuntu 20.04 and every newer release clear it, so only very old installs need a check.

Apt Repository, .deb Package or Snap: Which Installation Method Fits?

For a machine you actually write code on, use the apt repository. The .deb works when you want a quick install and still want apt handling updates later. I’d only reach for the snap if most of your apps already come from the Snap Store.

Microsoft’s Linux documentation is blunt about updates. apt updates work only when the repository is installed correctly, while the snap daemon updates VS Code in the background.

MethodHow updates arriveWho adds the repository and keyMain drawback
Apt repositoryapt upgrade, with the rest of the systemYou, once, by handSeveral setup commands
.deb packageapt upgrade, if you accept the promptThe installer, after you confirmNo updates if you skip the prompt
snapsnapd background refreshNot neededSnap-specific bugs

Apt repository: pros and cons

The big win is that VSCode updates in the same apt upgrade as everything else. Packages get checked against Microsoft’s signing key, and the repository covers amd64, arm64 and armhf. It also serves both code and code-insiders, which is handy if you want to try Insiders later.

What it costs you is four or five commands before the first install.

And there’s a nastier catch. A wrong keyring path breaks apt update for every package, not only VSCode, so the error shows up somewhere you aren’t looking. Took me a while the first time to connect a broken system update back to the editor.

.deb package: pros and cons

One download, one command. The installer prompts to add the apt repository and signing key, so apt takes over updates afterward.

You do have to fetch the file by hand. Skip the prompt and VSCode stays frozen at whatever version you downloaded.

For a single workstation this is the fastest route that still ends in a properly updated install.

Snap: pros and cons

The snap comes from a verified Visual Studio Code account on the Snap Store (Canonical’s listing, November 2026).

It’s a single command with no key or source file to manage. snapd handles updates in the background, and the same package shows up in the Ubuntu software store if you’d rather click than type.

The downside is an odd one. Deleted files land in a snap-local Trash folder instead of the system one, a bug reported in November 2024 and still being written up in February 2026 (The Register). Later sections cover it in detail.

Which one I’d actually pick

OMG Ubuntu and MakeUseOf both lead with the snap route, and it is the easiest one to type. The apt repository costs a few extra commands once and avoids the snap-specific bugs. On a daily development machine that trade is worth it.

On a box you rarely touch, the .deb is fine as long as you accept the repository prompt. If you’ve already standardized on Snap Store apps, go with the snap, keeping the caveats above in mind.

How to Install VSCode From the Microsoft apt Repository

YouTube player

You import Microsoft’s signing key, describe the repository in a deb822 sources file, then run sudo apt update and sudo apt install code. As of November 2026, Microsoft’s own steps put the key at /usr/share/keyrings/microsoft.gpg and the source in /etc/apt/sources.list.d/vscode.sources.

  1. Install the two tools the key import needs.
sudo apt install wget gpg
  1. Download Microsoft’s key and convert it into a binary keyring. apt uses it to verify package integrity and rejects anything that was altered.
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg
  1. Create the sources file with sudo nano /etc/apt/sources.list.d/vscode.sources and paste this content:
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Architectures: amd64,arm64,armhf
Signed-By: /usr/share/keyrings/microsoft.gpg
  1. Refresh the package index so apt sees the new repository.
sudo apt update
  1. Install the package. It’s named code.
sudo apt install code

Every later release arrives through the normal apt upgrade.

Older tutorials still use add-apt-repository or a vscode.list file with the archive keyring. Mixing those recipes with the steps above is a known source of conflicting Signed-By errors (see the troubleshooting section).

Installing the Insiders build

Stable has shipped weekly since version 1.111 on March 9, 2026 (Visual Studio Magazine), while Insiders delivers nightly builds.

The same repository serves both. Only the package name changes.

sudo apt install code-insiders

Stick with stable for daily work. Insiders makes sense when you specifically want to test upcoming features and don’t mind the occasional rough build.

Installing VSCode From the .deb Package

YouTube player

Download the .deb from Microsoft’s download page, run apt install on the file, and accept the prompt that adds Microsoft’s repository and signing key. That prompt is what turns on auto-updates through apt.

  1. Download the build that matches your architecture from the official VSCode download page at code.visualstudio.com.
  2. Open a terminal in the folder that holds the file, usually Downloads.
cd ~/Downloads
  1. Install with apt so it resolves dependencies. The glob works when only one VSCode .deb sits in the folder.
sudo apt install ./code_*.deb
  1. Answer yes when the installer offers to add the Microsoft repository and key.

On older systems, sudo dpkg -i followed by sudo apt-get install -f does the same job. dpkg installs the package but doesn’t fetch missing dependencies, and the second command repairs that.

If you decline the prompt, VSCode still installs. apt just never sees an update for it, because Microsoft’s documentation ties apt updates to a correctly installed repository.

Non-interactive installs

Scripts and provisioning tools can’t answer the prompt, so preseed the answer before installing.

echo "code code/add-microsoft-repo boolean true" | sudo debconf-set-selections

With true, the install adds the repository and key. Setting it to false skips both, which is the value an Ansible debconf task sets for fleets that manage repositories separately.

Installing VSCode With snap

Run sudo snap install --classic code. VSCode ships as a classic snap, so the --classic flag is part of the official command.

  1. Confirm snapd is present. Ubuntu desktop includes it by default, and Microsoft’s page points to the snapd installation guide when it is missing.
snap --version
  1. Install the stable snap.
sudo snap install --classic code
  1. Optionally add the Insiders snap beside it.
sudo snap install --classic code-insiders

Installing through the software store

The Ubuntu software store (App Center on current releases) installs the same snap. Search for “Visual Studio Code”, press Install, and enter your password when asked.

No terminal and no repository file. The package and its limits are identical to the command line route, though.

How snap updates VSCode

snapd updates VS Code on its own, and the editor shows an in-product notification when an update is available. If you don’t feel like waiting, sudo snap refresh code forces the check.

Snap is the least effort to install and also the method with the most documented caveats.

When the Snap Package Is the Wrong Choice

Any snap revision that predates the Trash fix is a bad bet. It’s also a poor fit when you run snap-installed command line tools from VSCode’s integrated terminal.

The Trash bug and what changed

The amounts people found were not small. One robotics engineer found almost 200 GB of files he believed he had deleted, and another developer found 44 GB dating back two years (The Register, 2026).

It traces back to a VSCode change from October 11, 2024 that set XDG_DATA_HOME to $SNAP_USER_DATA/.local/share. After that, deletes went to a snap-local folder at ~/snap/code/current/.local/share/Trash, and neither VS Code nor snap offers a way to manage it.

Snap keeps older revisions after updates, and each one carries its own copy. That’s how the totals got so big.

Trash wasn’t the only casualty either. Fish terminal history, uv Python installations and Jupyter Notebooks were affected too.

A pull request stops the snap from setting XDG_DATA_HOME and was targeted at the 1.139 Insiders build. The issue’s activity log shows the fix commit referencing the report on September 17, 2026, with the issue filed under the 1.139.0 milestone and labeled as released to Insiders and verified.

So the sources disagree, sort of. The Register and It’s FOSS described the bug as unfixed in February 2026, while the GitHub record shows a fix months later. Both were accurate for their dates.

Checking an existing snap install

The fix stops new files from landing in that folder. None of the retrieved sources says it removes folders created earlier.

code --version
du -sh ~/snap/code/*/.local/share/Trash

Compare the version with 1.139, the build the fix targeted, and look at the folder sizes. Review what’s inside before deleting anything, because everything in there is an item you removed inside VSCode.

Removing the snap also clears those leftovers, according to It’s FOSS. There’s a catch. A plain snap remove makes snapd save an automatic snapshot of the snap’s data, Trash folders included, and keep it for 31 days. Use sudo snap remove --purge code if you want the space back immediately.

Snap-installed tools inside the terminal

A separate report on VS Code 1.106.2 and Ubuntu 24.04 shows a snap-installed tool such as shellcheck failing in the integrated terminal with “cannot set privileged capabilities: Operation not permitted”. Extensions that call snap packages hit the same error.

The retrieved issue text shows no resolution. Test your toolchain before settling on snap.

For plain editing on a current build, snap is a defensible choice again. I still think the apt repository has fewer moving parts around the terminal.

Verifying the Installation and Launching VSCode

Run code --version. It prints the VS Code version, the GitHub commit ID and the architecture, such as x64 (Microsoft VS Code documentation).

If the shell answers “command not found”, Microsoft’s page suggests adding the VS Code binaries location to $PATH manually, or reinstalling.

From the terminal, code . opens the current folder, and code index.html style.css opens files, creating any that do not exist. The Insiders build launches with code-insiders.

On GNOME you can skip the terminal entirely. Press the Super key, type the app name, and click the icon.

For more on launching it that way, see this guide to opening VSCode from the terminal.

Not sure which method you used months ago? The binary path gives it away: /usr/bin/code for apt and .deb installs, and /snap/bin/code for snap.

Checkapt or .deb installsnap install
which code/usr/bin/code/snap/bin/code
snap list codeNo matching snapsLists the code snap
dpkg -l codeLists the packageNo packages found

How VSCode Updates on Ubuntu

When a new release reaches you depends on Microsoft’s repository lag for apt and .deb installs, or on the snapd refresh schedule if you went with the snap.

Apt and .deb installs

Microsoft’s Debian repository can lag up to three hours behind the latest release. So if apt says you’re up to date on release day, nothing is broken.

sudo apt update
sudo apt install --only-upgrade code

Sometimes apt reports that the repository changed its “Origin” value. Run sudo apt update (not apt-get) and accept the change.

To freeze a version, sudo apt-mark hold code stops apt from upgrading it. sudo apt-mark unhold code lets updates through again.

Snap installs

The snap system is scheduled to refresh four times per day by default. You can see when the last and next checks happen with snap refresh --time.

The snap refresh --hold command postpones updates for individual snaps, and needs snapd 2.58 or newer. To pause VSCode alone, run sudo snap refresh --hold=forever code, and lift it with sudo snap refresh --unhold code.

Why Does apt update Fail After Installing VSCode?

Usually because two sources or two keyrings describe the same Microsoft repository, or an old entry has no usable key. Keep one source file with one Signed-By path, delete the rest, and run sudo apt update again.

ErrorCauseFix
Conflicting values set for option Signed-ByTwo source files for the same repository point at different keyringsKeep one file and one keyring path
NO_PUBKEYAn old entry without signed-by, or a missing keyRemove the old entry, re-import the key
Repository is not signedA stale entry for the old repos/vscode pathDelete that file, keep repos/code
Changed its Origin valueRepository metadata changedAccept it with sudo apt update

Swif’s support documentation shows the first case in practice. Its agent’s own keyring for packages.microsoft.com/repos/code clashed with /usr/share/keyrings/microsoft.gpg.

Finding the duplicate

  1. List every Microsoft entry apt knows about.
grep -r "packages.microsoft.com" /etc/apt/sources.list.d/
  1. Keep the vscode.sources file from the apt repository section. Delete any other file that points at repos/code or the older repos/vscode path.
  2. Remove stray keyrings such as /etc/apt/trusted.gpg.d/microsoft*.gpg, but only if no other Microsoft repository (Edge, Azure CLI) depends on them.
  3. Run sudo apt update to confirm the error is gone.

Why guides disagree on file names and key paths

Even Microsoft isn’t consistent. Its install steps use vscode.sources with /usr/share/keyrings/microsoft.gpg (as of November 2026). The same page’s troubleshooting section still refers to vscode.list, and another retrieval of that page shows a vscode.list recipe with /etc/apt/keyrings/packages.microsoft.gpg.

Third-party guides add their own variations:

  • UbuntuHandbook: /etc/apt/keyrings/microsoft.gpg
  • PiMyLifeUp: a vscode.list file with microsoft-archive-keyring.gpg

Mix two of these schemes and apt sees two keyrings for one repository. Pick one and make every file point at the same keyring.

Removing VSCode and Its Repository From Ubuntu

Remove the package with apt or snap, then delete the Microsoft source file so apt stops contacting the repository. Your settings stay in your home directory until you delete them yourself.

Removing the apt or .deb install

  1. Remove the package.
sudo apt remove code
  1. Delete the repository file. Older recipes created vscode.list instead, and a wildcard removal of the vscode source files is a common approach.
sudo rm /etc/apt/sources.list.d/vscode.sources
  1. Delete the keyring, unless another Microsoft source still uses it.
sudo rm /usr/share/keyrings/microsoft.gpg
  1. Run sudo apt update. A clean run confirms apt no longer lists the repository.

For the Insiders build, swap in code-insiders as the package name.

Removing the snap

sudo snap remove code

By default snapd keeps an automatic snapshot of the snap’s data for 31 days after removal. Add --purge to skip that snapshot and free the space right away.

Copy your settings first. A finding in the GitHub issue notes that the snap treats ~/snap/code/current as its home directory, so look there for the snap’s settings instead of in ~/.config/Code.

Settings left behind

Microsoft documents the user settings file on Linux at $HOME/.config/Code/User/settings.json. Removing the package does not touch it.

Leave it if you plan to reinstall.

If you really want a clean slate, rm -rf ~/.config/Code deletes all VSCode user data in that folder. There is no undo.

Common Questions About VSCode Installation on Ubuntu

Is VSCode the same as Visual Studio?

No. VSCode is a lightweight code editor that runs on Linux, while Visual Studio is a separate Microsoft IDE with no Ubuntu version. The package you install on Ubuntu is named code.

Is VSCode free to use on Ubuntu?

Yes. Visual Studio Code is freely available for Windows, macOS, and Linux, and the apt repository, .deb and snap routes all deliver the same free editor.

Does a Flatpak version of VSCode exist?

There’s an unofficial one on Flathub (It’s FOSS, 2026). Microsoft’s own Linux page lists official Debian, RPM and Snap packages, plus community-maintained packages for Arch Linux and Nix, and does not mention Flatpak. On Ubuntu, stick to the .deb, the apt repository or the snap if you want supported packages.

Can the snap and the apt version run side by side?

Technically yes. Both provide a code command, though, and whichever path comes first in your shell decides which one launches. Snap maintainers triaging a VSCode bug asked the reporter to keep only the snap installed before testing, which tells you how messy that setup gets.

How do I install VSCode extensions from the terminal?

Run code --install-extension followed by the extension ID in publisher.extension form, or a path to a VSIX file. Add –force to skip prompts.

Switching From Snap to apt Without Losing Settings

Order matters here, and copying settings.json first comes before anything else.

Microsoft documents the apt install’s file at ~/.config/Code/User/settings.json, while the snap treats ~/snap/code/current as its home, so look for the snap’s copy under that folder.

  1. Copy settings.json out of the snap’s home folder.
  2. Remove the snap, so two code commands never compete on your PATH.
  3. Install code from the apt repository, then paste the settings back.

You’re trading snapd’s automatic refresh for a one-time repository setup and apt-driven upgrades. As of November 2026 the Trash bug has an upstream fix, so a current snap needs this switch only when snap-installed tools fail in the terminal.

With the install settled, deciding which extensions to add first is the natural next step.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.