安装
除非你有明确理由,否则使用安装器。它会设置 CLI 并运行 onboarding。快速安装(推荐)
系统要求
- Node >=22
- macOS、Linux 或通过 WSL2 的 Windows
- 仅在从源码构建时需要
pnpm
选择安装方式
1) 安装器脚本(推荐)
通过 npm 全局安装openclaw 并运行 onboarding。
2) 全局安装(手动)
如果你已经有 Node:sharp 安装失败,可强制使用预编译二进制:
sharp: Please add node-gyp to your dependencies,请安装构建工具(macOS:Xcode CLT + npm install -g node-gyp),或使用上面的 SHARP_IGNORE_GLOBAL_LIBVIPS=1 方案跳过原生构建。
或者:
3) 从源码(贡献者/开发)
pnpm openclaw ... 运行仓库命令。
4) 其他安装选项
安装后
- 运行 onboarding:
openclaw onboard --install-daemon - 快速检查:
openclaw doctor - 检查 gateway 健康:
openclaw status+openclaw health - 打开仪表盘:
openclaw dashboard
安装方式:npm vs git(安装器)
安装器支持两种方式:npm(默认):npm install -g openclaw@latestgit:从 GitHub clone/build 并从源码 checkout 运行
CLI flags
--install-method npm|git--git-dir <path>(默认:~/openclaw)--no-git-update(使用现有 checkout 时跳过git pull)--no-prompt(禁用提示;CI/自动化中必需)--dry-run(仅输出将执行的步骤,不做改动)--no-onboard(跳过 onboarding)
环境变量
等价环境变量(适用于自动化):OPENCLAW_INSTALL_METHOD=git|npmOPENCLAW_GIT_DIR=...OPENCLAW_GIT_UPDATE=0|1OPENCLAW_NO_PROMPT=1OPENCLAW_DRY_RUN=1OPENCLAW_NO_ONBOARD=1SHARP_IGNORE_GLOBAL_LIBVIPS=0|1(默认:1;避免sharp使用系统 libvips 构建)
故障排查:找不到 openclaw(PATH)
快速诊断:
$(npm prefix -g)/bin(macOS/Linux)或 $(npm prefix -g)(Windows)不在 echo "$PATH" 中,说明 shell 无法找到全局 npm 二进制(包含 openclaw)。
修复:把它加入 shell 启动文件(zsh:~/.zshrc,bash:~/.bashrc):
npm prefix -g 的输出加入 PATH。
然后打开新终端(或在 zsh 中 rehash / bash 中 hash -r)。