Run OpenClaw on Windows via WSL2. Step-by-step from enabling WSL2 to configuration and startup.
OpenClaw does not run natively on Windows. You need WSL2 (Windows Subsystem for Linux 2), Microsoft's official Linux subsystem with near-native performance. This guide walks you through everything from enabling WSL2 to deploying OpenClaw on Windows.
Open PowerShell as Administrator (right-click Start → Windows Terminal (Admin), or search PowerShell and right-click → Run as administrator) and run:
wsl --install
This command enables WSL2 and installs the default Ubuntu distribution. Restart your computer after installation.
After restart, verify WSL version in PowerShell:
wsl -l -v
Confirm Ubuntu shows VERSION 2. If it shows 1, upgrade with:
wsl --set-version Ubuntu 2
Open Ubuntu terminal (search Ubuntu in Start menu). All following commands run inside WSL2. Update system packages first, then install Node.js 22:
# 更新系统包 sudo apt update && sudo apt upgrade -y # 通过 NodeSource 安装 Node.js 22 curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt install -y nodejs
Verify the installation:
node --version\nnpm --version
Ensure Git is installed (usually pre-installed), then clone and install:
# 安装 Git(如果没有的话) sudo apt install -y git # 克隆 OpenClaw git clone https://github.com/openclaw/openclaw.git # 进入项目并安装依赖 cd openclaw && npm install
Copy the example config and edit with nano (Ctrl+O to save, Ctrl+X to exit):
cp .env.example .env\nnano .env
Fill in your API keys and access password:
# OpenClaw 环境变量配置 OPENAI_API_KEY=sk-your-openai-api-key # ANTHROPIC_API_KEY=sk-ant-your-key # DEEPSEEK_API_KEY=your-deepseek-key DEFAULT_MODEL=gpt-4o ACCESS_CODE=your-secure-password PORT=3210
After saving .env, start OpenClaw:
npm start
Once started, open the URL below in your Windows browser. WSL2 automatically forwards ports to the Windows host:
http://localhost:3210
Always keep the project in WSL2's filesystem (e.g., ~/openclaw), NOT under /mnt/c/ or /mnt/d/. Cross-filesystem I/O is dramatically slower (10x+), making npm install and startup very slow.
WSL2 uses substantial host memory by default. If your PC has limited RAM (under 8GB), create %USERPROFILE%/.wslconfig to limit WSL2 memory. Add [wsl2] and memory=2GB to cap usage at 2GB.
We strongly recommend installing VS Code with the WSL extension. Run code . in the project directory to edit WSL2 files directly — native Linux development experience.
If WSL2 feels too complex, Docker Desktop for Windows is an easier alternative (also WSL2-based but fully GUI-configured). Start OpenClaw with docker-compose — no manual Node.js setup needed.
Your agent is installed but can't think or talk yet — configure an LLM API and messaging tool to bring it alive.
Feed Your Agent