openclaw update 安全更新 OpenClaw 并在 stable/beta/dev 渠道间切换。
npm/pnpm/bun 全局安装(无 git 元数据)时,通过包管理器流程更新。
常用命令
openclaw update # 更新到当前渠道最新版
openclaw update status # 查看当前渠道和版本信息
openclaw update wizard # 交互式选择渠道和重启选项
openclaw update --channel beta # 切换到 beta 渠道并更新
openclaw update --channel dev # 切换到 dev 渠道(需要 git checkout)
openclaw update --dry-run # 预览更新计划,不实际执行
openclaw update --json # 机器可读输出
openclaw --update # 等同于 openclaw update选项
| 选项 | 说明 |
|---|---|
--channel <stable|beta|dev> | 设置更新渠道(持久化到配置) |
--tag <spec> | 仅本次更新覆盖包目标,main 映射到 github:openclaw/openclaw#main |
--no-restart | 更新后不重启 Gateway 服务 |
--dry-run | 预览计划,不写配置/安装/重启 |
--yes | 跳过确认(如降级确认) |
--timeout <seconds> | 每步超时,默认 1800s |
渠道行为
| 渠道 | 安装方式 | 说明 |
|---|---|---|
stable | npm latest | 最新稳定版 |
beta | npm beta | 无 beta 时回退到 stable |
dev | git checkout main | 默认路径 ~/openclaw,可用 OPENCLAW_GIT_DIR 覆盖 |
git checkout 更新步骤
- 验证工作树干净(无未提交变更)
- 切换到目标渠道(tag 或 branch)
- dev 渠道:fetch upstream
- dev 渠道:preflight 构建(失败时最多回退 10 个 commit)
- dev 渠道:rebase
- 安装依赖(pnpm checkout 自动 bootstrap pnpm)
- 构建 Gateway 和 Control UI
- 运行
openclaw doctor - 同步插件到当前渠道
包管理器更新流程
npm 全局安装使用分阶段安装:先安装到临时 prefix 并验证 dist 清单,验证通过后替换正式 prefix。更新后自动重启 Gateway 并验证版本一致性。
Nix 模式
OPENCLAW_NIX_MODE=1 时,mutating 更新被禁用。update status 和 --dry-run 仍可用。
相关链接
- cli-completion — 更新后刷新 shell 补全
- docs/gateway/logging — 调试更新时的 Gateway 日志