GuideJuly 29, 20258 min read

Setting Up WSL2 for Development: A Complete Guide

WSL2 gives you a real Linux environment inside Windows. Here is how to set it up for development and sync your existing configs from macOS or Linux.

Why WSL2 Changes Everything for Windows Developers

WSL2 (Windows Subsystem for Linux 2) runs a real Linux kernel inside Windows. Unlike WSL1, which translated Linux system calls, WSL2 uses a lightweight virtual machine with full system call compatibility. This means Docker runs natively, filesystem performance is dramatically better, and virtually every Linux tool works exactly as expected.

For developers who use Windows but work with Linux-based tooling — which is most developers — WSL2 eliminates the need to dual-boot or run a full VM. And because ConfigSync treats WSL2 as a standard Linux environment, you can sync your Mac or Linux configs directly into your WSL2 instance with no extra work.

Installing WSL2 and Your Distro

If you have not set up WSL2 yet, the process is straightforward on Windows 10 (build 2004+) or Windows 11:

Install WSL2 from PowerShell (as Administrator)
# Install WSL with Ubuntu (default) > wsl --install # Or choose a specific distro > wsl --install -d Ubuntu-24.04 # After restart, set up your Linux username and password # Then open Ubuntu from the Start menu

Once your distro is running, you are in a full Linux environment. Everything from here on out is standard Linux — the same commands work whether you are on bare metal Ubuntu, a cloud VM, or WSL2.

Installing Node.js and ConfigSync

The recommended way to install Node.js in WSL2 is via nvm, which gives you version management and avoids permission issues:

Install Node.js via nvm
# Install nvm $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # Restart your shell, then install Node.js $ nvm install --lts # Verify $ node --version v22.12.0
Install ConfigSync
# Install ConfigSync globally $ npm install -g @inventivehq/configsync # Authenticate with your account $ configsync setup --token cs_abc123 Authenticated as sean@example.com Machine registered: Sean's WSL2 (Ubuntu) Found latest snapshot from 2026-03-24T10:00:00Z

Syncing from Your Mac or Linux Machine

The power of ConfigSync with WSL2 is pulling your existing environment from another machine. If you have been using ConfigSync on your Mac, your configs are already in the cloud. Pull them into WSL2:

Pull from your Mac
$ configsync pull --from "MacBook Pro" --install Pulling snapshot from MacBook Pro (2026-03-24T10:00:00Z)... ✓ shell ~/.zshrc, ~/.zprofile (restored) ✓ git ~/.gitconfig, ~/.gitignore_global (restored) ✓ ssh ~/.ssh/config, 2 key pairs (decrypted) ✓ vim ~/.config/nvim/ (restored) ✓ node ~/.npmrc, global packages (installed) ✓ python pip.conf, global packages (installed) ✓ packages Mapping Homebrew → apt... Installing 34 packages via apt... ✓ env 3 .env files (decrypted & restored) Restored 18 modules in 4m 22s.
ConfigSync automatically maps Homebrew packages to their apt equivalents when pulling from macOS to Linux. Packages like ripgrep, jq, and fd are translated to the correct apt package names. Casks that have no Linux equivalent (like macOS-only apps) are skipped with a warning.

Cross-Platform Config with Template Conditionals

WSL2 reports its platform as linux, which means ConfigSync's template conditionals handle WSL-specific paths and settings automatically:

Platform-aware configs in WSL2
# In your .zshrc tracked by ConfigSync: export EDITOR="nvim" alias ll="ls -la --color=auto" {{#if platform == "linux"}} # Linux/WSL2 paths export PATH="$HOME/.local/bin:$PATH" alias open="wslview" # WSL equivalent of macOS 'open' alias pbcopy="clip.exe" # Use Windows clipboard from WSL alias pbpaste="powershell.exe -command 'Get-Clipboard'" {{/if}} {{#if platform == "darwin"}} # macOS paths export PATH="/opt/homebrew/bin:$PATH" {{/if}}

When ConfigSync restores this file on WSL2, it evaluates the conditionals and produces a clean .zshrc with only the Linux-specific sections. Your macOS-specific config is stripped out automatically, so there are no broken paths or missing commands.

Package Mapping: Brew to Apt

ConfigSync maintains a mapping table that translates packages across package managers. Here is how common development packages map from Homebrew to apt:

Homebrew (macOS)apt (WSL2 Ubuntu)Notes
gitgitDirect match
ripgrepripgrepDirect match
fdfd-findDifferent package name
batbatDirect match (Ubuntu 20.04+)
jqjqDirect match
ghghRequires GitHub apt repo
docker (cask)docker.ioNative Docker in WSL2
visual-studio-code (cask)SkippedUse VS Code Remote WSL from Windows

Note that GUI applications like VS Code are skipped on WSL2 because they run on the Windows side. The recommended approach is to install VS Code on Windows and use the Remote WSL extension to edit files inside your WSL2 environment.

Common WSL2 Gotchas

WSL2 is excellent, but there are a few things to watch out for when setting up your development environment:

SSH Agent Forwarding

If you use SSH keys on the Windows side (for example, in Windows Terminal or PuTTY), you may want to forward the SSH agent into WSL2 rather than maintaining separate keys. Tools like npiperelay or wsl2-ssh-agent bridge the Windows SSH agent into WSL2. Alternatively, ConfigSync can restore your SSH keys directly into WSL2 so you do not need forwarding at all.

File System Performance

Always keep your project files inside the WSL2 filesystem (under /home/username/), not on the Windows filesystem (under /mnt/c/). Accessing Windows files from WSL2 is significantly slower due to the 9P protocol bridge. ConfigSync restores files to your Linux home directory by default, so this is handled automatically.

VS Code Remote WSL

Install VS Code on Windows, then install the "WSL" extension. When you run code . from inside WSL2, it opens VS Code on Windows with a remote connection into your WSL2 environment. Your ConfigSync VS Code settings apply to the WSL2 side automatically.

Managing WSL2 and Windows Independently

ConfigSync treats your WSL2 instance and your Windows environment as separate machines. This is intentional — they have different package managers, different paths, and often different needs. You can push and pull independently:

Independent machine management
# Inside WSL2 $ configsync push Pushed snapshot for "Sean's WSL2 (Ubuntu)" # On Windows (if using ConfigSync for Windows) # These are separate machines with separate snapshots # On your Mac $ configsync pull --from "Sean's WSL2 (Ubuntu)" # Pull WSL2 configs to your Mac if needed

This separation means you can customize your WSL2 environment independently — adding Linux-specific tools or configs — without affecting your macOS or Windows setup. Each machine is a first-class citizen in ConfigSync.

WSL2 Is a First-Class Linux Environment

The beauty of WSL2 is that it is just Linux. ConfigSync does not need any special WSL2 support because everything works exactly as it would on a native Linux machine. Your zsh config, git settings, SSH keys, vim setup, and project environment variables all work identically. If you are already using ConfigSync on macOS or Linux, adding a WSL2 machine to your sync is effortless.

Install ConfigSync, pull your environment, and start coding. WSL2 handles the rest.

Ready to try ConfigSync?

Sync your entire dev environment across machines in minutes. Free forever for up to 3 devices.