- 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
- WSL 2 (latest version)
- Ubuntu Linux (default distribution)
- Required kernel components
Launch WSL
Install OpenCode
Run OpenCode
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:
Enable WSL feature
Enable Virtual Machine Platform
Restart Windows
Download WSL kernel update
Set WSL 2 as default
Install Linux distribution
Verify Installation
VERSION is 2. If it shows 1, upgrade:Accessing Windows Files
WSL mounts Windows drives under/mnt/:
Performance Considerations
Performance Optimization
Performance Optimization
- Native WSL (
~/projects/): ~0.8 seconds - Windows mount (
/mnt/c/projects/): ~3.2 seconds
~/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.Start web server in WSL
Open in Windows browser
http://localhost:3000- Modern web UI
- Server runs in performant WSL environment
- Access from any Windows browser
- Requires browser
- Slightly higher resource usage
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.Start server in WSL with external access
Install OpenCode Desktop on Windows
Connect Desktop app to WSL server
- Click server name in bottom-right
- Enter URL:
http://localhost:4096 - Enter credentials (username:
opencode, password: your password)
- 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
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
Install Remote-WSL extension
- Open Extensions (
Ctrl+Shift+X) - Search “Remote - WSL”
- Click Install
Open project from WSL
Run OpenCode in integrated terminal
Ctrl+ `):- 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: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
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
/mnt/c/).Fix: Move project to WSL:Cannot access WSL files from Windows
Cannot access WSL files from Windows
\\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
OpenCode can't find Node/Python/etc.
OpenCode can't find Node/Python/etc.
Port already in use
Port already in use
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
Enable WSL 2 backend
Enable Ubuntu integration
Verify in WSL
- 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:Create .wslconfig file
Add configuration
Restart WSL
Disable Windows Defender for WSL
Windows Defender can slow down file operations:Open Windows Security
Add exclusions
%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.*\\wsl$\Ubuntu\home\<yourusername>\projects
Migration: Windows → WSL
Moving existing projects to WSL:Identify project locations
Copy to WSL
Update Git remotes (if needed)
Reinstall dependencies
Best Practices
Store projects in WSL
~/projects/ instead of /mnt/c/ for 3-4x faster performance.