Skip to content

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.

  • Windows 10 or 11
  • WSL2 (Ubuntu 24.04 recommended)
  • PowerShell with Administrator privileges
  • pnpm (for the installation process)

I suggest following these steps to get your environment running in about five minutes.

Open PowerShell as an Administrator and run:

Terminal window
wsl --install -d Ubuntu-24.04

Restart your computer if Windows asks you to.

The Gateway service requires systemd to run. Inside your WSL terminal, run:

Terminal window
sudo tee /etc/wsl.conf >/dev/null <<'EOF'
[boot]
systemd=true
EOF

Shut down WSL from PowerShell to apply the change:

Terminal window
wsl --shutdown

Re-open Ubuntu and verify it is working with systemctl --user status.

Run these commands inside your WSL terminal to set up the project:

Terminal window
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build
pnpm build
openclaw onboard

You can set up the background service by running:

Terminal window
openclaw onboard --install-daemon

You can also use openclaw gateway install or openclaw configure and select the Gateway service option when prompted.

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.

Terminal window
$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=$TargetPort

You must also allow the port through the Windows Firewall:

Terminal window
New-NetFirewallRule -DisplayName "WSL SSH $ListenPort" -Direction Inbound `
-Protocol TCP -LocalPort $ListenPort -Action Allow

Gateway or migration issues If things stop working after an update or a migration, I recommend using the doctor command to repair the setup:

Terminal window
openclaw doctor

Remote 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.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.