更新

更新

OpenClaw 正在快速迭代(预 "1.0" 版本)。将更新视为部署基础设施:更新 → 运行检查 → 重启(或使用 openclaw update,它会重启)→ 验证。

推荐:重新运行网站安装程序(就地升级)

首选更新方式是重新运行网站安装程序。它会检测现有安装、就地升级,并在需要时运行 openclaw doctor

curl -fsSL https://openclaw.bot/install.sh | bash

说明:

更新前

更新(全局安装)

全局安装(选择一个):

npm i -g openclaw@latest
pnpm add -g openclaw@latest

我们不推荐 Bun 作为 Gateway 运行时(WhatsApp/Telegram 有 bug)。

切换更新通道(git + npm 安装):

openclaw update --channel beta
openclaw update --channel dev
openclaw update --channel stable

使用 --tag <dist-tag|version> 进行一次性安装标签/版本。

参见 [开发通道(../install/development-channels.html) 了解通道语义和发布说明。

注意:在 npm 安装上,Gateway 在启动时记录更新提示(检查当前通道标签)。通过 update.checkOnStart: false 禁用。

然后:

openclaw doctor
openclaw gateway restart
openclaw health

说明:

更新(openclaw update

对于 源码安装(git checkout),优先使用:

openclaw update

它运行一个安全的更新流程:

如果你通过 npm/pnpm 安装(无 git 元数据),openclaw update 会尝试通过你的包管理器更新。如果它无法检测安装,改用"更新(全局安装)"。

更新(Control UI / RPC)

Control UI 有 更新并重启(RPC: update.run)。它:

  1. 运行与 openclaw update 相同的源码更新流程(仅 git checkout)。
  2. 写入带结构化报告(stdout/stderr 尾部)的重启标记。
  3. 重启 Gateway 并向最后活动会话发送报告。

如果变基失败,Gateway 中止并重启而不应用更新。

更新(从源码)

从仓库 checkout:

优先:

openclaw update

手动(大致等效):

git pull
pnpm install
pnpm build
pnpm ui:build # 首次运行时自动安装 UI 依赖
openclaw doctor
openclaw health

说明:

始终运行:openclaw doctor

Doctor 是"安全更新"命令。它有意设计得无聊:修复 + 迁移 + 警告。

注意:如果你在 源码安装(git checkout)上,openclaw doctor 会提供先运行 openclaw update

典型操作:

详情:[Doctor(../gateway/doctor.html)

启动 / 停止 / 重启 Gateway

CLI(适用于任何 OS):

openclaw gateway status
openclaw gateway stop
openclaw gateway restart
openclaw gateway --port 18789
openclaw logs --follow

如果你受控:

运行手册 + 精确服务标签:Gateway 运行手册

回滚 / 固定(当出现问题时)

固定(全局安装)

安装已知良好的版本(将 <version> 替换为最后一个工作的版本):

npm i -g openclaw@<version>
pnpm add -g openclaw@<version>

提示:查看当前发布版本,运行 npm view openclaw version

然后重启 + 重新运行 doctor:

openclaw doctor
openclaw gateway restart

固定(源码)按日期

选择日期的提交(示例:"2026-01-01 的 main 状态"):

git fetch origin
git checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)"

然后重新安装依赖 + 重启:

pnpm install
pnpm build
openclaw gateway restart

如果你稍后想回到最新版本:

git checkout main
git pull

如果你卡住