OpenClaw 提供三个安装脚本,从 openclaw.ai 提供服务。
| 脚本 | 平台 | 说明 |
|---|---|---|
install.sh | macOS / Linux / WSL | 安装 Node(如需)、通过 npm 或 git 安装 OpenClaw,可运行 onboarding |
install-cli.sh | macOS / Linux / WSL | 安装到本地 prefix(~/.openclaw),无需 root |
install.ps1 | Windows (PowerShell) | 安装 Node(如需)、通过 npm 或 git 安装 OpenClaw |
install.sh(推荐)
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash安装流程:
- 检测 OS(macOS/Linux/WSL)
- 确保 Node.js 24(Homebrew on macOS,NodeSource on Linux)
- 确保 Git
- 安装 OpenClaw(npm 默认,或 git 方式)
- 刷新 gateway service,运行
openclaw doctor,执行 onboarding
常用参数:
# 跳过 onboarding
bash -s -- --no-onboard
# git 安装方式
bash -s -- --install-method git
# 安装 main 分支
bash -s -- --version main
# 预览(不实际执行)
bash -s -- --dry-run关键 flags:
| Flag | 说明 |
|---|---|
--install-method npm|git | 安装方式(默认 npm) |
--version <ver> | npm 版本/dist-tag/spec |
--beta | 使用 beta dist-tag |
--no-onboard | 跳过 onboarding |
--dry-run | 预览不执行 |
--verbose | 调试输出 |
install-cli.sh(本地 prefix)
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install-cli.sh | bash安装到 ~/.openclaw 前缀,下载固定版本 Node LTS,无需 root。支持 --json 输出用于自动化。
# 自定义 prefix 和版本
bash -s -- --prefix /opt/openclaw --version latest
# JSON 输出(CI 用)
bash -s -- --json --prefix /opt/openclawinstall.ps1(Windows)
iwr -useb https://openclaw.ai/install.ps1 | iex自动尝试 winget → Chocolatey → Scoop 安装 Node。
# git 安装
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -InstallMethod git
# 预览
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -DryRunCI/自动化
# 非交互式 npm 安装
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-prompt --no-onboard
# JSON 输出
curl -fsSL https://openclaw.ai/install-cli.sh | bash -s -- --json --prefix /opt/openclaw常见问题
- 安装成功但找不到
openclaw:PATH 问题,参见 install-node - Linux EACCES:npm global prefix 指向 root 目录,脚本可自动切换到
~/.npm-global - Windows “openclaw is not recognized”:将
npm config get prefix输出的目录加入用户 PATH
相关链接
- install-node — Node.js 安装与 PATH 排查
- install-updating — 更新 OpenClaw
- install-uninstall — 卸载 OpenClaw