Skip to content

Instantly share code, notes, and snippets.

@corncobble
Last active August 11, 2025 19:40
Show Gist options
  • Select an option

  • Save corncobble/30e73e55f8c051c0b5ead311fdf52bb8 to your computer and use it in GitHub Desktop.

Select an option

Save corncobble/30e73e55f8c051c0b5ead311fdf52bb8 to your computer and use it in GitHub Desktop.
Using Visual Studio Code in WSL2 locally

This writeup assumes you are using Ubuntu for WSL2 on an x64 machine.

  1. Download the Visual Studio Code package, typically found here: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
  2. Update apt and install the package: sudo apt update && sudo apt install /path/to/code_1.102.3-1753759567_amd64.deb
  3. During installation it should prompt you to install the apt repository and signing key to enable auto-updating using the system's package manager. This is recommended.
  4. Type code to start.

Two things I've noticed so far:

  • The window will be drawn tiny if using a high resolution monitor. Use the Electron (Chromium) startup parameter --force-device-scale-factor=1.x to fix this.
  • Before startup you will be prompted to install Code for Windows instead. I haven't yet found a reason to needlessly do remote development via SSH over doing it locally inside WSL2. Use the DONT_PROMPT_WSL_INSTALL=1 environment variable to fix this.

Using the above, my ~/bash_aliases includes this:

alias code='DONT_PROMPT_WSL_INSTALL=1 code --force-device-scale-factor=1.75'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment