Why WSL is recommended:
- 10-20x faster file I/O operations
- Full POSIX compatibility for shell commands
- Seamless integration with Linux development tools
- Better terminal emulator support
- Native Git performance
Quick Start
Install WSL
Open PowerShell as Administrator and run:This installs:
- WSL 2 (latest version)
- Ubuntu Linux (default distribution)
- Required kernel components
Launch WSL
After restart, open “Ubuntu” from the Start menu.Create a UNIX username and password (does not need to match Windows credentials).
WSL Installation Details
Prerequisites
- Windows 10 version 2004+ (Build 19041+) or Windows 11
- Virtualization enabled in BIOS/UEFI
- Administrator access for initial setup
Manual Installation
Ifwsl --install doesn’t work:
Download WSL kernel update
WSL2 Kernel Update (x64)Install the downloaded MSI package.
Verify Installation
Ensure
VERSION is 2. If it shows 1, upgrade:Accessing Windows Files
WSL mounts Windows drives under/mnt/:
Performance Considerations
Performance Optimization
Performance Optimization
For best performance, store projects in the WSL filesystem:Benchmark comparison (reading 1000 files):
- Native WSL (
~/projects/): ~0.8 seconds - Windows mount (
/mnt/c/projects/): ~3.2 seconds
VS Code Remote-WSL extension can edit files in
~/projects/ seamlessly.Architecture Patterns
Pattern 1: TUI in WSL (Recommended)
Best for: Developers who prefer terminal interfaces.- Best performance
- Full feature support
- Native terminal experience
- Terminal-only (no GUI)
Pattern 2: Web Client + WSL Server
Best for: Developers who prefer browser-based UIs. ✅ Pros:- Modern web UI
- Server runs in performant WSL environment
- Access from any Windows browser
- Requires browser
- Slightly higher resource usage
WSL automatically forwards
localhost ports to Windows. No additional configuration needed.Pattern 3: Desktop App + WSL Server
Best for: Users who want native desktop app with WSL performance.Install OpenCode Desktop on Windows
Download from opencode.ai/download
- Native desktop app experience
- Server performance benefits from WSL
- System notifications work
- Requires password authentication
- More complex setup
If localhost doesn't work
If localhost doesn't work
Get WSL’s IP address:Connect Desktop app to
http://172.20.10.5:4096 instead of localhost:4096.File Editing
VS Code Remote-WSL (Recommended)
Edit files in WSL filesystem from Windows:Install VS Code on Windows
Download from code.visualstudio.com
Install Remote-WSL extension
In VS Code:
- Open Extensions (
Ctrl+Shift+X) - Search “Remote - WSL”
- Click Install
- Edit in GUI, run in WSL
- Full IntelliSense and extensions
- Git integration
- Side-by-side with OpenCode TUI
Windows File Explorer
Access WSL files from Windows:- Open File Explorer
- Type
\\wsl$in address bar - Navigate to your files
Git Configuration
Separate Git Configs
WSL and Windows Git are separate. Configure Git in WSL:SSH Keys
Generate SSH keys in WSL:WSL SSH keys are separate from Windows. You’ll need to add the new public key to GitHub/GitLab.
Terminal Recommendations
Windows Terminal (Best)
Modern terminal with tabs, GPU acceleration, and WSL integration. Install:- Microsoft Store: “Windows Terminal”
- Or via
winget:
- Open Windows Terminal
- Settings → Startup → Default profile: Ubuntu
- Settings → Ubuntu → Appearance → Font: “Cascadia Code NF”
Alternative: Termius, iTerm2-like
For users wanting more features:- Tabby - Cross-platform, highly customizable
- Fluent Terminal - Modern UWP terminal
Troubleshooting
WSL won't start
WSL won't start
Error:
The virtual machine could not be started...Fix:- Enable Virtualization in BIOS:
- Restart → Enter BIOS (F2/DEL/F12)
- Find “Virtualization Technology” or “VT-x/AMD-V”
- Enable → Save → Reboot
- Ensure Windows features are enabled:
Slow file operations
Slow file operations
Symptoms: OpenCode takes minutes to start, file edits lag.Cause: Project is on Windows filesystem (
/mnt/c/).Fix: Move project to WSL:Cannot access WSL files from Windows
Cannot access WSL files from Windows
Symptoms:
\\wsl$ path not found in File Explorer.Fix:-
Ensure WSL is running:
-
Start WSL if stopped:
-
Retry accessing
\\wsl$\Ubuntu
Git credentials not working
Git credentials not working
Symptoms: Git push asks for password every time.Fix: Use Windows credential manager from WSL:Or set up SSH keys (see Git Configuration section).
OpenCode can't find Node/Python/etc.
OpenCode can't find Node/Python/etc.
Cause: Tool installed in Windows, not WSL.Fix: Install tools in WSL:
Port already in use
Port already in use
Symptoms: Or use a different port:
opencode serve fails with “port 4096 already in use”.Cause: Windows process using the port.Fix:Advanced: Docker in WSL
Docker Desktop Integration
Install Docker Desktop for Windows
Download from docker.com
- Running MCP servers in containers
- Containerized development environments
- Building and testing Docker images
Performance Tuning
Increase WSL Memory Limit
By default, WSL uses 50% of total RAM. For large projects:Disable Windows Defender for WSL
Windows Defender can slow down file operations:Migration: Windows → WSL
Moving existing projects to WSL:Leave originals on Windows until you’ve verified everything works in WSL.
Best Practices
Store projects in WSL
Use
~/projects/ instead of /mnt/c/ for 3-4x faster performance.Use Windows Terminal
Better performance, tabs, and customization than Command Prompt or PowerShell.
VS Code Remote-WSL
Edit files seamlessly while benefiting from WSL’s speed.
Docker Desktop WSL 2 backend
Native container performance with Windows UI.
Next Steps
Server Configuration
Advanced server setup for WSL environments.
Network Setup
Configure proxies and certificates in WSL.
Troubleshooting
Diagnose and fix WSL-specific issues.
VS Code Integration
Connect OpenCode with VS Code in WSL.