更新
OpenClaw 更新很快(仍处于 1.0 之前)。像运维一样对待更新:更新 → 运行检查 → 重启(或使用会自动重启的openclaw update)→ 验证。
推荐:重新运行官网安装器(原地升级)
首选更新路径是重新运行官网安装器。它会检测已有安装,原地升级,并在需要时运行openclaw doctor。
- 若不想再次运行 onboarding 向导,添加
--no-onboard。 - 源码安装请使用:
安装器只会在仓库干净时执行
git pull --rebase。 - 全局安装时,脚本内部会使用
npm install -g openclaw@latest。 - 旧版兼容:
openclaw仍作为兼容 shim 提供。
更新前准备
- 确认你的安装方式:全局(npm/pnpm)vs 源码(git clone)。
- 确认 Gateway 的运行方式:前台终端 vs 受监督服务(launchd/systemd)。
- 备份你的定制:
- Config:
~/.openclaw/openclaw.json - Credentials:
~/.openclaw/credentials/ - Workspace:
~/.openclaw/workspace
- Config:
更新(全局安装)
全局安装(任选其一):--tag <dist-tag|version> 做一次性安装 tag/版本。
通道语义与发布说明见 Development channels。
注意:在 npm 安装中,gateway 启动时会记录更新提示(检查当前通道 tag)。可通过 update.checkOnStart: false 关闭。
然后:
- 若 Gateway 以服务方式运行,优先使用
openclaw gateway restart,不要手动杀 PID。 - 若你固定在某个版本,请看下方“回滚 / 固定”。
更新(openclaw update)
对 源码安装(git checkout)推荐使用:
- 需要干净的 worktree。
- 切换到所选通道(tag 或分支)。
- 获取并基于上游 rebase(dev 通道)。
- 安装依赖、构建、构建 Control UI,然后运行
openclaw doctor。 - 默认重启 gateway(用
--no-restart跳过)。
openclaw update 会尝试走包管理器更新;若无法识别安装方式,改用上面的“全局安装更新”。
更新(Control UI / RPC)
Control UI 提供 Update & Restart(RPC:update.run)。它会:
- 运行与
openclaw update相同的源码更新流程(仅 git checkout)。 - 写入一个包含结构化报告的重启哨兵(stdout/stderr tail)。
- 重启 gateway,并将报告发送到最近的活跃会话。
更新(从源码)
在仓库 checkout 中: 推荐:- 当你运行打包的
openclaw二进制(openclaw.mjs)或用 Node 运行dist/时,pnpm build很重要。 - 如果你在仓库中直接从 TypeScript 运行(
pnpm openclaw ...),通常无需 rebuild,但配置迁移仍然需要 → 运行 doctor。 - 全局与 git 安装之间切换很容易:安装另一种方式,然后运行
openclaw doctor以重写 gateway 服务入口为当前安装方式。
始终运行:openclaw doctor
Doctor 是“安全更新”命令。它刻意保持无聊:修复 + 迁移 + 提示。
注意:如果你是 源码安装(git checkout),openclaw doctor 会先建议运行 openclaw update。
它通常会做:
- 迁移已废弃的配置键 / 旧的配置文件位置。
- 审核 DM 策略并对高风险 “open” 设置告警。
- 检查 Gateway 健康,必要时建议重启。
- 识别并迁移旧的 gateway 服务(launchd/systemd;旧 schtasks)到当前 OpenClaw 服务。
- 在 Linux 上确保 systemd user lingering(保证 Gateway 退出登录后仍存活)。
启动 / 停止 / 重启 Gateway
CLI(跨 OS 通用):- macOS launchd(app 内置 LaunchAgent):
launchctl kickstart -k gui/$UID/bot.molt.gateway(使用bot.molt.<profile>;旧com.openclaw.*仍可用) - Linux systemd 用户服务:
systemctl --user restart openclaw-gateway[-<profile>].service - Windows(WSL2):
systemctl --user restart openclaw-gateway[-<profile>].servicelaunchctl/systemctl仅在服务已安装时有效;否则运行openclaw gateway install。
回滚 / 固定版本(出问题时)
固定(全局安装)
安装一个已知良好的版本(把<version> 替换为上一次正常版本):
npm view openclaw version。
然后重启 + 重新运行 doctor:
固定(源码)按日期
从某天的提交中选一个(例:“2026-01-01 时点的 main”):如果卡住了
- 再次运行
openclaw doctor并仔细阅读输出(经常会提示修复办法)。 - 查看:Troubleshooting
- 去 Discord 提问:https://channels.discord.gg/clawd