安装概述
除非你有理由,否则使用安装程序。它设置 CLI 并运行引导。
快速安装(推荐)
bash
curl -fsSL https://openclaw.ai/install.sh | bashWindows (PowerShell):
powershell
iwr -useb https://openclaw.ai/install.ps1 | iex下一步(如果你跳过了引导):
bash
openclaw onboard --install-daemon系统要求
- Node.js ≥ 22
- macOS、Linux 或通过 WSL2 的 Windows
pnpm仅当从源码构建时
选择你的安装路径
1) 安装脚本(推荐)
通过 npm 全局安装 openclaw 并运行引导。
bash
curl -fsSL https://openclaw.ai/install.sh | bash安装标志:
bash
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --help详情:安装程序内部
非交互式(跳过引导):
bash
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard2) 全局安装(手动)
如果你已经安装了 Node:
bash
npm install -g openclaw@latest如果你已全局安装 libvips(在 macOS 上通过 Homebrew 很常见)且 sharp 安装失败,强制使用预构建的二进制文件:
bash
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest如果你看到 sharp: Please add node-gyp to your dependencies,要么安装构建工具(macOS:Xcode CLT + npm install -g node-gyp),要么使用上面的 SHARP_IGNORE_GLOBAL_LIBVIPS=1 解决方法来跳过原生构建。
或:
bash
pnpm add -g openclaw@latest然后:
bash
openclaw onboard --install-daemon3) 从源码(贡献者/开发)
bash
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build # 首次构建时自动安装 UI 依赖
pnpm build
openclaw onboard --install-daemon提示:如果还没有全局安装,通过 pnpm openclaw ... 运行仓库命令。
4) 其他安装选项
安装后
- 运行引导:
openclaw onboard --install-daemon - 快速检查:
openclaw doctor - 检查网关健康:
openclaw status+openclaw health - 打开仪表板:
openclaw dashboard
安装方法:npm vs git(安装程序)
安装程序支持两种方法:
npm(默认):npm install -g openclaw@latestgit:从 GitHub 克隆/构建并从源码检出运行包装器脚本
CLI 标志
bash
# 明确的 npm
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method npm
# 从 GitHub 安装(源码检出)
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git常用标志:
--install-method npm|git--git-dir <path>(默认:~/openclaw)--no-git-update(使用现有检出时跳过git pull)--no-prompt(禁用提示;在 CI/自动化中需要)--dry-run(打印将要执行的操作;不做任何更改)--no-onboard(跳过引导)
环境变量
等效的环境变量(对自动化有用):
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)
快速诊断:
bash
node -v
npm -v
npm prefix -g
echo "$PATH"如果 $(npm prefix -g)/bin(macOS/Linux)或 $(npm prefix -g)(Windows)不存在于 echo "$PATH" 中,你的 shell 找不到全局 npm 二进制文件(包括 openclaw)。
修复:将其添加到你的 shell 启动文件(zsh:~/.zshrc,bash:~/.bashrc):
bash
# macOS / Linux
export PATH="$(npm prefix -g)/bin:$PATH"在 Windows 上,将 npm prefix -g 的输出添加到你的 PATH。
然后打开新终端(或在 zsh 中 rehash / 在 bash 中 hash -r)。