推荐方式:openclaw update

自动检测安装类型(npm 或 git),拉取最新版本,运行 openclaw doctor,重启 gateway。

openclaw update

切换频道或指定版本:

openclaw update --channel beta
openclaw update --channel dev
openclaw update --tag main
openclaw update --dry-run   # 预览,不实际执行

频道说明:

  • stable:稳定版,延迟 stableDelayHours 后应用,带抖动分散更新
  • beta:每 betaCheckIntervalHours(默认 1 小时)检查,立即应用
  • dev:git checkout,不自动应用,手动运行 openclaw update

切换安装类型

# npm 安装 → git checkout(dev 模式)
openclaw update --channel dev
 
# git checkout → npm 安装
openclaw update --channel stable

先用 --dry-run 预览切换过程。

备选方式

重新运行安装脚本:

curl -fsSL https://openclaw.ai/install.sh | bash
# 跳过 onboarding
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
# 恢复特定版本
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method npm --version <version>

手动 npm/pnpm/bun:

npm i -g openclaw@latest
pnpm add -g openclaw@latest
bun add -g openclaw@latest

手动更新后立即重启 gateway,避免旧进程继续服务已替换的包文件。

自动更新

默认关闭,在 ~/.openclaw/openclaw.json 中启用:

{
  update: {
    channel: "stable",
    auto: {
      enabled: true,
      stableDelayHours: 6,
      stableJitterHours: 12,
      betaCheckIntervalHours: 1,
    },
  },
}

紧急禁用自动更新:OPENCLAW_NO_AUTO_UPDATE=1。

更新后操作

openclaw doctor          # 迁移配置、检查 gateway 健康
openclaw gateway restart
openclaw health

回滚

npm 安装:

npm i -g openclaw@<version>
openclaw doctor
openclaw gateway restart

查看当前发布版本:npm view openclaw version

源码安装:

git fetch origin
git checkout "$(git rev-list -n 1 --before="2026-01-01" origin/main)"
pnpm install && pnpm build
openclaw gateway restart
# 恢复最新:git checkout main && git pull

相关链接