安装部署 OpenClaw
共三种安装方式,推荐用一键脚本。
方式一:一键安装脚本(推荐)
macOS / Linux / WSL2:
bash
curl -fsSL https://openclaw.ai/install.sh | bash
Windows PowerShell:
powershell
iwr -useb https://openclaw.ai/install.ps1 | iex
如果只想安装、不立即进入配置向导:
bash
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
方式二:npm 手动安装
bash
# 确保 Node.js 22+node --version# 全局安装 OpenClawnpm install -g openclaw@latest# 运行配置向导(同时安装守护进程)openclaw onboard --install-daemon
方式三:Docker 部署
bash
docker pull openclaw/openclaw:latestdocker run -d \--name openclaw \-p 18789:18789 \-v ~/.openclaw:/root/.openclaw \-e ANTHROPIC_API_KEY=sk-ant-xxx \openclaw/openclaw:latest
安装后验证
bash
openclaw --versionopenclaw doctoropenclaw gateway statusopenclaw dashboard
openclaw dashboard 能正常打开,说明网关已可用(默认端口 18789)。
常见问题
命令找不到:
bash
npm prefix -gexport PATH="$(npm prefix -g)/bin:$PATH"
sharp 编译失败(macOS 常见):
bash
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
端口冲突:
bash
lsof -i :18789openclaw gateway --port 19000
网关无法启动:
bash
openclaw doctor --fixopenclaw logs --follow