养虾指南
OpenClaw System Guide
Requires WSL2

Install OpenClaw on Windows (WSL2)

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.

Prerequisites

  • Windows 10 (version 2004+) or Windows 11
  • Administrator privileges (needed for WSL2)
  • At least 4GB available memory (WSL2 + OpenClaw)
  • At least 10GB available disk space
  • At least one LLM API key
Important: OpenClaw does NOT run natively on Windows. WSL2 is required. If you prefer not to deal with WSL2, we strongly recommend the Docker Desktop method, which also works on Windows and is easier to set up.
1

Enable and Install WSL2

Open PowerShell as Administrator (right-click Start → Windows Terminal (Admin), or search PowerShell and right-click → Run as administrator) and run:

PowerShell (Admin)
wsl --install

This command enables WSL2 and installs the default Ubuntu distribution. Restart your computer after installation.

If it says already installed, run wsl --update to ensure it's up to date. After restart, Ubuntu will prompt for a Linux username and password (used for sudo, separate from Windows password).
2

Verify WSL2 Mode and Install Ubuntu

After restart, verify WSL version in PowerShell:

PowerShell
wsl -l -v

Confirm Ubuntu shows VERSION 2. If it shows 1, upgrade with:

PowerShell
wsl --set-version Ubuntu 2
3

Install Node.js 22 in WSL2

Open Ubuntu terminal (search Ubuntu in Start menu). All following commands run inside WSL2. Update system packages first, then install Node.js 22:

Ubuntu (WSL2)
# 更新系统包
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:

Ubuntu (WSL2)
node --version\nnpm --version
4

Clone OpenClaw and Install Dependencies

Ensure Git is installed (usually pre-installed), then clone and install:

Ubuntu (WSL2)
# 安装 Git(如果没有的话)
sudo apt install -y git

# 克隆 OpenClaw
git clone https://github.com/openclaw/openclaw.git

# 进入项目并安装依赖
cd openclaw && npm install
Important: Keep the project in WSL2's filesystem (e.g., ~/openclaw), NOT under /mnt/c/. Cross-filesystem operations result in 10x slower file I/O!
5

Configure Environment and Start

Copy the example config and edit with nano (Ctrl+O to save, Ctrl+X to exit):

Ubuntu (WSL2)
cp .env.example .env\nnano .env

Fill in your API keys and access password:

.env
# 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
Always set ACCESS_CODE! Without it, devices on your local network can access your OpenClaw instance.

After saving .env, start OpenClaw:

Ubuntu (WSL2)
npm start

Once started, open the URL below in your Windows browser. WSL2 automatically forwards ports to the Windows host:

Windows Browser
http://localhost:3210
If you see the OpenClaw interface, installation is complete! Next time: open Ubuntu terminal and run cd ~/openclaw && npm start.

Notes for Windows Users

1. File System Performance

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.

2. Memory Limit Configuration

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.

3. Edit Files with VS Code

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.

4. Easier Alternative: Docker Desktop

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.

Installed! Next: Feed Your Agent

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