Windows setup

11 min read

Windows WSL2 for OpenClaw

The practical way to run OpenClaw on Windows. Install WSL2, choose the right distro, keep performance fast, and sidestep the Windows-specific gotchas that trip up most first setups.

Most Windows beginners do not fail because OpenClaw is hard. They fail because Windows and Linux keep passing the wrench back and forth. WSL2 fixes that by giving OpenClaw a proper Linux home while you keep your normal Windows desktop.

Think of WSL2 as a workshop behind your office. Windows stays the front desk. Linux handles the tools. If you keep walking your files back and forth through the hallway, everything gets slower and weirder. If you work inside the shop, things calm down fast.

What WSL2 is actually doing for you

WSL2 runs a real Linux kernel in a lightweight virtualized layer. For OpenClaw, that matters because the project expects Linux-style shells, permissions, paths, package managers, and service behavior. You still launch it from a Windows machine, but the runtime stops pretending to be something it is not.

  • Better compatibility: Fewer path, permission, and shell oddities.
  • Cleaner docs fit: Most OpenClaw commands and examples already assume Linux.
  • Less friction: Git, Node, pnpm, Python, and shell tools behave more predictably.
  • Safer separation: Your AI workspace can live in Linux without turning your whole Windows machine into a science project.

If you want the official baseline first, use Microsoft's WSL install guide. For command lookup later, keep the WSL command reference nearby.

Minimum setup before you touch OpenClaw

You need a recent Windows 10 or Windows 11 build, admin access for the initial WSL installation, and one Linux distro. Ubuntu is the easiest default because most community examples assume it.

# Run in an elevated PowerShell window
wsl --install

# Restart Windows when prompted

# Back in PowerShell, confirm the install
wsl --list --verbose

After the reboot, open your Linux distro, create your Linux username, and let the first-time setup finish. That part is not glamorous, but it is the moment your Windows box stops being a hostile environment for Linux tooling.

Pick the right place for your files

This is the mistake that wastes the most time. Do not put your OpenClaw repo under /mnt/c/Users/... if you plan to work from the Linux shell. It works just well enough to trick you, then punishes you during installs, rebuilds, and file watching.

Store your project under your Linux home directory instead:

mkdir -p ~/workspace
cd ~/workspace
git clone https://github.com/openclaw/openclaw.git
cd openclaw

The rule is simple: Linux tools want Linux files. Windows tools want Windows files. Crossing that line is possible, but you should have a reason, not a habit.

Install the tooling inside WSL2, not half in each world

A messy WSL2 setup usually comes from split-brain installs. Node lives in Windows, pnpm lives in Linux, Git is whichever copy answered first, and then everyone acts surprised when scripts break.

Keep your core dev tools inside the distro you plan to use for OpenClaw:

  • Git
  • Node.js
  • pnpm
  • Python 3 for helper tooling
  • Docker integration if you plan to use the Docker path

That is the quiet advantage of WSL2. Once you stop mixing environments, the weird errors become boring again. Boring is good.

Two valid OpenClaw paths on Windows

Option 1: Run OpenClaw directly inside WSL2

This is the cleaner route if you want a development setup and do not need Docker for isolation. You work from the Linux shell, install dependencies there, and run OpenClaw as if the machine were a normal Linux box.

cd ~/workspace/openclaw
pnpm install
pnpm dev

Use this when you want the fastest feedback loop and the least moving parts.

Option 2: Use Docker with WSL integration

This is the better route if you want the officially recommended container workflow. The important part is not just installing Docker Desktop. It is enabling WSL integration for the distro where your OpenClaw repo lives, then launching Docker commands from inside that same distro.

cd ~/workspace/openclaw
./docker-setup.sh

If Docker is installed but your distro cannot talk to it, you usually have an integration problem, not an OpenClaw problem.

Windows-specific pain points that keep showing up

Slow installs and rebuilds

If pnpm install feels suspiciously slow, or the dev server acts like every file change is a personal insult, check where the repo lives. Projects under /mnt/c are the usual culprit.

Port confusion

Sometimes a Windows process is already using the port you expect inside WSL2. When the gateway refuses to start, check both sides before blaming the app. Windows and Linux are neighbors here, not strangers.

Browser automation headaches

Headless browser flows usually work with less drama than headed ones. If you need a visible browser, Windows 11 with WSLg is much smoother than older X server workarounds. If your use case is mostly scraping, form fills, or login reuse, headless mode will save your mood.

GPU and local model instability

WSL2 can work with local models, but this is where the workshop analogy starts to strain. Once you pile on GPU drivers, large models, browser tasks, and long-running agents, native Linux starts looking less like overkill and more like mercy.

A practical OpenClaw workflow that stays sane

  1. Install WSL2 and one Ubuntu distro.
  2. Keep your repo under ~/workspace or another Linux path.
  3. Install Node, pnpm, Git, and helper tools inside WSL2.
  4. Choose either direct runtime or Docker. Do not improvise a hybrid unless you know why.
  5. Use Windows only as the host desktop, editor surface, and browser layer.

That split works because each side gets a clear job. Windows is where you click. Linux is where OpenClaw lives.

Troubleshooting checklist

If the setup is acting cursed, walk this list in order:

# Inside WSL2
uname -a
pwd
node -v
pnpm -v
git --version
wsl.exe --status
wsl.exe --list --verbose
  • If the repo path starts with /mnt/, move it into your Linux home.
  • If Docker commands fail, verify Docker Desktop is running and WSL integration is enabled for your distro.
  • If browser tools fail, try headless mode first and check the browser automation guide.
  • If filesystem watchers miss changes, suspect cross-filesystem paths before anything exotic.
  • If everything works except performance, the path layout is usually the first thing to fix.

When you should skip WSL2

WSL2 is great for a developer workstation. It is not the final answer for every serious deployment. If you want 24/7 uptime, simpler networking, fewer Windows updates in the middle of your plans, or better conditions for heavy local models, use a Linux machine or VPS.

In plain English: WSL2 is excellent for building and learning. For always-on production, Linux still wins without much debate.

FAQ

Can I run OpenClaw directly on native Windows without WSL2?

You can force parts of the stack onto native Windows, but it is usually more painful than useful. OpenClaw behaves more predictably inside a Linux environment, which is why WSL2 is the practical Windows path.

Where should I store my OpenClaw project on Windows with WSL2?

Keep the project inside the Linux filesystem, usually under /home/your-user. Running from /mnt/c works, but file-heavy tasks like installs, builds, and watcher-based tooling often feel much slower there.

Do I need Docker Desktop for OpenClaw on Windows?

Only if your OpenClaw setup depends on Docker. If you use the Docker workflow, pair Docker Desktop with WSL integration for your distro. If you run OpenClaw directly in the WSL shell, Docker is optional.

Why do browser tasks or headed apps fail inside WSL2?

Those tasks usually fail because display support, browser dependencies, or sandbox permissions are missing. Windows 11 with WSLg helps a lot. On older setups, headless mode is usually the path of least resistance.

When is WSL2 the wrong choice?

If you need near-native GPU tuning for local models, heavy media work, or long-running production hosting, a real Linux box or VPS is often cleaner. WSL2 is excellent for a Windows workstation, not magic for every job.

Need help from people who already use this stuff?

Need help taming a Windows setup?

Join My AI Agent Profit Lab and compare your setup with builders who already solved the usual WSL2 messes.