Appearance
openclaw update
安全更新 OpenClaw,并在 stable/beta/dev 通道之间切换。
如果你是通过 npm/pnpm 全局安装的(没有 git 元数据),更新方式请参考包管理器流程:更新指南。
用法
bash
openclaw update
openclaw update status
openclaw update wizard
openclaw update --channel beta
openclaw update --channel dev
openclaw update --tag beta
openclaw update --tag main
openclaw update --dry-run
openclaw update --no-restart
openclaw update --json
openclaw --update参数说明
--no-restart:更新成功后跳过 Gateway 服务重启。--channel <stable|beta|dev>:设置更新通道(适用于 git 和 npm 安装;会持久化到配置文件)。--tag <dist-tag|version|spec>:仅针对本次更新覆盖包目标,不修改配置。对于包安装,main会映射到github:openclaw/openclaw#main。--dry-run:预览计划中的更新操作(通道/标签/目标/重启流程),不实际写配置、安装、同步插件或重启。--json:输出机器可读的UpdateRunResultJSON。--timeout <seconds>:每个步骤的超时时间(默认 1200 秒)。
注意:降级操作需要确认,因为旧版本可能导致配置格式不兼容。
update status
查看当前更新通道、git 标签/分支/SHA(仅限源码安装),以及是否有可用更新。
bash
openclaw update status
openclaw update status --json
openclaw update status --timeout 10参数:
--json:输出机器可读的状态 JSON。--timeout <seconds>:检查超时时间(默认 3 秒)。
update wizard
交互式向导:选择更新通道,确认是否在更新后重启 Gateway(默认重启)。如果选择 dev 通道但没有 git checkout,向导会提示你创建一个。
工作原理
显式切换通道(--channel ...)时,OpenClaw 会同步对齐安装方式:
dev→ 确保存在 git checkout(默认路径:~/openclaw,可通过OPENCLAW_GIT_DIR覆盖),更新后从该 checkout 安装全局 CLI。stable/beta→ 使用对应 dist-tag 从 npm 安装。
Gateway 核心自动更新器(在配置中启用后)复用同一套更新路径。
Git 源码安装的升级流程
各通道说明:
stable:检出最新的非 beta 标签,然后构建 + doctor 检查。beta:检出最新的-beta标签,然后构建 + doctor 检查。dev:检出main分支,然后 fetch + rebase。
完整步骤:
- 要求工作区干净(无未提交更改)。
- 切换到目标通道(标签或分支)。
- 拉取上游更新(仅 dev 通道)。
- 仅 dev 通道:在临时 worktree 中执行预检 lint + TypeScript 构建;如果最新提交构建失败,最多向前回溯 10 个提交,找到最新的干净构建。
- Rebase 到目标提交(仅 dev 通道)。
- 安装依赖(优先 pnpm,失败则回落 npm)。
- 构建主体 + Control UI。
- 运行
openclaw doctor作为"安全更新"的最终验证。 - 将插件同步到当前通道(dev 用捆绑扩展,stable/beta 用 npm),并更新 npm 安装的插件。
--update 简写
openclaw --update 等价于 openclaw update,方便在 shell 脚本和启动器中使用。
给你的龙虾升级很简单:
openclaw update一条命令搞定,Gateway 会在更新后自动重启,全程无需手动干预。