Setting up OpenClaw on Windows with WSL2
I have spent far too many hours fighting with tools that were built for Linux but forced to run on Windows. Things often break because of path issues, missing dependencies, or incompatible binaries. To save you that trouble, I recommend running OpenClaw through WSL2. It gives you a consistent Linux environment where your tools just work.
WSL2 is the best way to handle the CLI and Gateway right now. While native Windows companion apps are planned, this setup ensures you have the full runtime experience without the typical Windows configuration headaches.
What You’ll Need
Section titled “What You’ll Need”- Windows 10 or 11
- WSL2 (Ubuntu 24.04 recommended)
- PowerShell with Administrator privileges
- pnpm (for the installation process)
Quick Start
Section titled “Quick Start”I suggest following these steps to get your environment running in about five minutes.
1. Install WSL2 and Ubuntu
Section titled “1. Install WSL2 and Ubuntu”Open PowerShell as an Administrator and run:
wsl --install -d Ubuntu-24.04Restart your computer if Windows asks you to.
2. Enable systemd
Section titled “2. Enable systemd”The Gateway service requires systemd to run. Inside your WSL terminal, run:
sudo tee /etc/wsl.conf >/dev/null <<'EOF'[boot]systemd=trueEOFShut down WSL from PowerShell to apply the change:
wsl --shutdownRe-open Ubuntu and verify it is working with systemctl --user status.
3. Install OpenClaw
Section titled “3. Install OpenClaw”Run these commands inside your WSL terminal to set up the project:
git clone https://github.com/openclaw/openclaw.gitcd openclawpnpm installpnpm ui:buildpnpm buildopenclaw onboard4. Install the Gateway service
Section titled “4. Install the Gateway service”You can set up the background service by running:
openclaw onboard --install-daemonYou can also use openclaw gateway install or openclaw configure and select the Gateway service option when prompted.
Advanced: Expose WSL to your LAN
Section titled “Advanced: Expose WSL to your LAN”Since WSL uses its own virtual network, other machines cannot reach your services by default. If you need to reach the Gateway or a local TTS server from another device, use this PowerShell script (as Administrator) to forward the ports.
$Distro = "Ubuntu-24.04"$ListenPort = 2222$TargetPort = 22
$WslIp = (wsl -d $Distro -- hostname -I).Trim().Split(" ")[0]if (-not $WslIp) { throw "WSL IP not found." }
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=$ListenPort ` connectaddress=$WslIp connectport=$TargetPortYou must also allow the port through the Windows Firewall:
New-NetFirewallRule -DisplayName "WSL SSH $ListenPort" -Direction Inbound ` -Protocol TCP -LocalPort $ListenPort -Action AllowTroubleshooting
Section titled “Troubleshooting”Gateway or migration issues If things stop working after an update or a migration, I recommend using the doctor command to repair the setup:
openclaw doctorRemote nodes cannot connect
WSL IPs change whenever you restart the environment. If your remote nodes cannot find the Gateway, use openclaw status --all to verify the reachable URL. Ensure you are not using 127.0.0.1 if you need access from other machines on your network.
If you hit a wall, check out the AI Setup Assistant.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.