更新预览
使用 openclaw update --dry-run 命令可以查看更新预览。
执行命令:
openclaw update --dry-run
执行结果:
admin@192 workspace % openclaw update --dry-run
Update dry-run
No changes were applied.
Root: /Users/admin/.npm-global/lib/node_modules/openclaw
Install kind: package
Mode: npm
Channel: stable
Tag/spec: openclaw@latest
Current version: 2026.5.7
Target version: 2026.5.22
Planned actions:
- Run global package manager update with spec openclaw@latest
- Run plugin update sync after core update
- Refresh shell completion cache (if needed)
- Restart gateway service and run doctor checks
结果解读:
openclaw update --dry-run 输出解读
这是一个非常好的实践——先 dry-run 看看会发生什么,再决定是否执行。
当前环境状态
| 项目 | 值 |
|---|---|
| Root | /Users/admin/.npm-global/lib/node_modules/openclaw |
| Install kind |
package — 通过包管理器安装的(不是 git clone 的源码) |
| Mode |
npm — 使用 npm 作为包管理器 |
| Channel |
stable — 当前锁定在稳定通道 |
| Tag/spec |
openclaw@latest — 更新目标是 npm 的 latest 标签 |
| Current version | 2026.5.7 |
| Target version | 2026.5.22 |
简单说:你当前装的是 5 月 7 日 的版本,最新稳定版是 5 月 22 日 的,落后了 15 天的发布。
计划执行的四步操作
dry-run 模拟了如果你正式执行 openclaw update 会发生什么,按顺序是:
1. 全局包管理器更新
Run global package manager update with spec openclaw@latest
等价于执行 npm install -g openclaw@latest,把核心包从 2026.5.7 升到 2026.5.22。
2. 插件同步
Run plugin update sync after core update
核心版本变了,插件可能也需要跟着更新以保持兼容。这一步会同步插件版本。
3. 刷新 Shell 补全缓存
Refresh shell completion cache (if needed)
如果新版本增加了新的子命令或选项,shell 的 tab 补全脚本需要更新。括号里的 "if needed" 说明如果版本差异小、命令结构没变,这一步可能跳过。
4. 重启 Gateway 并健康检查
Restart gateway service and run doctor checks
重启 OpenClaw 的网关服务加载新版本,然后运行内置的 doctor 命令做一轮自检——确认新版本能正常运行。
几个值得注意的点
没有降级警告 — 当前是正向升级(5.7 → 5.22),所以不会触发降级确认提示。如果你 --tag 2026.4.1 做降级,dry-run 输出里会出现额外的警告。
安装来源是 npm 全局安装 — 所以更新走的是 npm install -g 流程,而不是 git fetch/rebase 那套。如果你是从源码 clone 的,Mode 会显示 git,计划动作也会完全不同。
"No changes were applied" — 这句话确认了 dry-run 的承诺:它只展示了计划,没有实际修改任何东西。
下一步建议
既然 dry-run 看起来一切正常,正向升级、没有风险项,你可以放心执行:
openclaw update
如果你希望在后台自动完成且不被打断:
openclaw update --yes
升级完成后可以用 openclaw update status 确认版本已经变成 2026.5.22。
更新状态查询
使用 openclaw update status 命令可以先查看更新状态。
执行命令:
openclaw update status
执行结果:
admin@192 workspace % openclaw update status
OpenClaw update status
┌──────────┬───────────────────────────────────────────────────────────────────────────────────┐
│ Item │ Value │
├──────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Install │ pnpm │
│ Channel │ stable (default) │
│ Update │ available · pnpm · npm update 2026.5.22 │
└──────────┴───────────────────────────────────────────────────────────────────────────────────┘
Update available (npm 2026.5.22). Run: openclaw update
结果解读:
openclaw update status 输出解读
一个简洁的状态表,告诉你三件事:
逐行解读
Install: pnpm
检测到你的 OpenClaw 是通过 pnpm 全局安装的。这比之前 dry-run 里显示的 npm 更精确——dry-run 的 Mode: npm 指的是 npm 注册表生态,而这里 Install: pnpm 指的是实际执行更新的包管理器。实际更新时会跑 pnpm update 而不是 npm install -g。
Channel: stable (default)
当前锁定在稳定通道,且括号里的 default 说明你没有手动切换过通道——这是出厂默认值。如果你之前执行过 --channel beta,这里会显示 beta 而不带 default 标记。
Update: available · pnpm · npm update 2026.5.22
有新版本可用。三个信息点:
-
available— 可以更新 -
pnpm— 更新将通过 pnpm 执行 -
2026.5.22— 目标版本号
底部提示
Update available (npm 2026.5.22). Run: openclaw update
这是一个人性化的提醒,直接告诉你该跑什么命令。
一个小细节
dry-run 和 status 之间对包管理器的显示有轻微差异(npm vs pnpm),这说明 dry-run 的 Mode 字段展示的是更新通道/注册表类型(npm registry),而 status 的 Install 展示的是本地实际使用的包管理器工具。不矛盾,只是视角不同。
可以直接执行 openclaw update 完成升级了。
更新
执行命令:
openclaw update

执行结果:
admin@192 workspace % openclaw update
Updating OpenClaw...
Stopping managed gateway service before package update...
Warning: launchctl stop did not fully stop the service; used bootout fallback and left service unloaded
Stopped LaunchAgent (degraded): gui/501/ai.openclaw.gateway
│
◇ ✓ Updating via package manager (153.85s)
│
◇ ✓ Running doctor checks (36.04s)
Update Result: OK
Root: /Users/admin/.npm-global/lib/node_modules/openclaw
Before: 2026.5.7
After: 2026.5.22
Total time: 195.71s
│
◇
Updating plugins...
No plugin updates needed.
Restarting service...
Gateway did not become healthy after restart.
Service runtime: status=running, state=running, pid=29085
Port 18789 is already in use.
- pid 29085 admin: /usr/local/bin/node /Users/admin/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789 (127.0.0.1:18789)
- Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
Restart log: /Users/admin/.openclaw/logs/gateway-restart.log
Run `openclaw gateway status --deep` for details.
Recovery: run `openclaw gateway restart`; if macOS reports the LaunchAgent is installed but not loaded, run `openclaw gateway install --force` from the logged-in user session, then rerun `openclaw gateway status --deep`.
Rollback: reinstall OpenClaw 2026.5.7 with the same package manager, then rerun `openclaw gateway install --force`.
结果解读:
openclaw update 完整输出解读
更新包本身成功了,但网关服务重启遇到了问题。逐段来看:
第一阶段:停止旧服务
Stopping managed gateway service before package update...
Warning: launchctl stop did not fully stop the service; used bootout fallback and left service unloaded
Stopped LaunchAgent (degraded): gui/501/ai.openclaw.gateway
更新前需要先停掉正在运行的网关。macOS 上用的是 launchctl(LaunchAgent 机制)。正常流程是 launchctl stop,但这次没完全停掉,所以回退到了 bootout 强制卸载。
"left service unloaded" 是关键信息——它把 LaunchAgent 从 launchctl 里卸载了(不仅仅是停止),但标记为 degraded,意味着停服过程不够干净,后续恢复可能需要额外操作。
第二阶段:包更新 + 健康检查
◇ ✓ Updating via package manager (153.85s)
◇ ✓ Running doctor checks (36.04s)
Update Result: OK
Root: /Users/admin/.npm-global/lib/node_modules/openclaw
Before: 2026.5.7
After: 2026.5.22
Total time: 195.71s
这部分完美完成:
- pnpm 更新包:153.85 秒
- doctor 自检:36.04 秒
- 版本从 2026.5.7 成功升级到 2026.5.22
第三阶段:插件同步
Updating plugins...
No plugin updates needed.
插件和新版核心兼容,不需要额外更新。
第四阶段:服务重启(出问题了)
Gateway did not become healthy after restart.
这是核心问题。往下看具体原因:
Service runtime: status=running, state=running, pid=29089
Port 18789 is already in use.
- pid 29085 admin: /usr/local/bin/node .../openclaw/dist/index.js gateway --port 18789 (127.0.0.1:18789)
- Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
端口冲突。情况是这样的:
| PID | 状态 | 说明 |
|---|---|---|
| 29085 | 旧进程,仍在占用端口 18789 | 前面 launchctl stop 标记为 "degraded" 停服,显然这个老进程没被彻底杀掉 |
| 29089 | 新进程,启动了但无法绑定端口 | 新版网关尝试启动,发现 18789 被占,健康检查失败 |
简单说:旧进程没死透,新进程起不来。
恢复建议
输出给出了三级修复方案,按你的需求选择:
最快修复(推荐先试)
openclaw gateway stop
openclaw gateway restart
手动停掉旧进程,再重启新版本。
如果 LaunchAgent 状态异常
openclaw gateway install --force
openclaw gateway status --deep
从当前登录用户会话里强制重新注册 LaunchAgent,再做深度状态检查。
最坏情况:回滚
# 用 pnpm 回退到旧版本
pnpm install -g openclaw@2026.5.7
openclaw gateway install --force
总结
| 项目 | 状态 |
|---|---|
| 包更新 | 成功 (5.7 → 5.22) |
| doctor 检查 | 通过 |
| 插件同步 | 无需更新 |
| 网关重启 | 失败(端口占用) |
| 整体 | 包更新成功,服务需要手动干预 |
这不是严重的更新失败——核心代码已经到位了,只是旧进程的生命周期管理出了小问题。先 openclaw gateway stop 再 openclaw gateway restart 大概率就能解决。
重启服务:
openclaw gateway restart
打开后台
openclaw dashboard