openclaw update
安全地更新 OpenClaw 并在 stable/beta/dev Channel 之间切换。
如果你是通过 npm/pnpm 安装的(全局安装,没有 git 元数据),更新会通过包管理器流程进行,详见更新。
用法
openclaw update
openclaw update status
openclaw update wizard
openclaw update --channel beta
openclaw update --channel dev
openclaw update --tag beta
openclaw update --no-restart
openclaw update --json
openclaw --update
选项
--no-restart:更新成功后跳过重启 Gateway 服务。--channel <stable|beta|dev>:设置更新 Channel(git + npm;会保存到配置中)。--tag <dist-tag|version>:仅为本次更新覆盖 npm dist-tag 或版本。--json:输出机器可读的UpdateRunResultJSON。--timeout <seconds>:每步超时时间(默认 1200 秒)。
注意:降级需要确认,因为旧版本可能会破坏配置。
update status
显示当前活跃的更新 Channel + git tag/branch/SHA(针对源码安装),以及可用更新。
openclaw update status
openclaw update status --json
openclaw update status --timeout 10
选项:
--json:输出机器可读的状态 JSON。--timeout <seconds>:检查超时时间(默认 3 秒)。
update wizard
交互式流程,让你选择更新 Channel 并确认更新后是否重启 Gateway(默认会重启)。如果你选择 dev 但没有 git 仓库,会提示创建一个。
工作原理
当你显式切换 Channel(--channel ...)时,OpenClaw 会保持安装方式的一致性:
dev→ 确保有 git 仓库(默认:~/openclaw,可用OPENCLAW_GIT_DIR覆盖),更新它,并从该仓库安装全局 CLI。stable/beta→ 使用匹配的 dist-tag 从 npm 安装。
Git 仓库流程
Channel 说明:
stable:检出最新的非 beta tag,然后构建 + doctor。beta:检出最新的-betatag,然后构建 + doctor。dev:检出main,然后 fetch + rebase。
高层流程:
- 要求工作树干净(没有未提交的更改)。
- 切换到选定的 Channel(tag 或分支)。
- 拉取上游(仅 dev)。
- 仅 dev:在临时工作树中预检 lint + TypeScript 构建;如果最新提交失败,会回溯最多 10 个提交来找到最新的干净构建。
- Rebase 到选定的提交(仅 dev)。
- 安装依赖(优先 pnpm;npm 作为备选)。
- 构建 + 构建 Control UI。
- 运行
openclaw doctor作为最终的”安全更新”检查。 - 同步 Plugin 到活跃 Channel(dev 使用捆绑扩展;stable/beta 使用 npm)并更新 npm 安装的 Plugin。
--update 简写
openclaw --update 会重写为 openclaw update(方便在 shell 和启动脚本中使用)。
另请参阅
openclaw doctor(在 git 仓库上会先提示运行更新)- 开发 Channel
- 更新
- CLI 参考