更新

OpenClaw 发展很快�?1.0”之前)。像对待发货基础设施一样对待更新:更新 �?运行检�?�?重启(或使用 openclaw update,它会重启)�?验证�?

推荐:重新运行网站安装程序(原地升级�?

**首�?*更新路径是重新运行来自网站的安装程序。它 检测现有安装、原地升级,并在需要时运行 openclaw doctor�?

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

注意�?

  • 如果你不想再次运行入门向导,请添�?--no-onboard�?

  • 对于**源代码安�?*,使用:

    curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git --no-onboard

    安装程序�?git pull --rebase仅当仓库干净时才执行�?

  • 对于全局安装,脚本在后台使用 npm install -g openclaw@latest�?

  • 旧版本说明:clawdbot 仍然作为兼容填充工具可用�?

更新之前

  • 知道你是如何安装的:全局(npm/pnpm)vs 从源代码(git clone)�?
  • 知道你的 Gateway 是如何运行的�?前台终端* vs 托管服务(launchd/systemd)�?
  • 快照你的定制�?
    • 配置:~/.openclaw/openclaw.json
    • 凭证:~/.openclaw/credentials/
    • 工作区:~/.openclaw/workspace

更新(全局安装�?

全局安装(选择一个)�?

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

我们**不推�?*�?Bun 用于 Gateway 运行时(WhatsApp/Telegram 存在缺陷)�?

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

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

使用 --tag <dist-tag|version> 进行一次性安装标�?版本�?

关于频道语义和发布说明,参见开发频道�?

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

核心自动更新器(可选)

自动更新�?默认关闭*,是 Gateway 的核心功能(不是插件)�?

{
  "update": {
    "channel": "stable",
    "auto": {
      "enabled": true,
      "stableDelayHours": 6,
      "stableJitterHours": 12,
      "betaCheckIntervalHours": 1
    }
  }
}

行为�?

  • stable:当看到新版本时,OpenClaw 等待 stableDelayHours,然后在 stableJitterHours 中应用确定性每安装抖动(分阶段推出)�?
  • beta:按 betaCheckIntervalHours 频率检查(默认:每小时)并在有更新可用时应用�?
  • dev:无自动应用;使用手�?openclaw update�?

启用自动化之前,使用 openclaw update --dry-run 预览更新操作�?

然后�?

openclaw doctor
openclaw gateway restart
openclaw health

注意�?

  • 如果你的 Gateway 作为服务运行,优先使�?openclaw gateway restart 而不是杀�?PIDs�?
  • 如果你固定到特定版本,请参见下面�?回滚/固定”�?

更新(openclaw update�?

对于**源代码安�?*(git checkout),优先使用�?

openclaw update

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

  • 需要干净的工作树�?
  • 切换到选定的频道(标签或分支)�?
  • 获取并重新基于配置的上游(dev 频道)�?
  • 安装依赖、构建、构�?Control UI,并运行 openclaw doctor�?
  • 默认重启 gateway(使�?--no-restart 跳过)�?

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

更新(Control UI / RPC�?

Control UI �?更新并重�?(RPC:update.run)。它�?

  1. 运行�?openclaw update 相同的源代码更新流程(仅�?git checkout)�?
  2. 写入带有结构化报告的重启标记(stdout/stderr 尾部)�?
  3. 重启 gateway 并使用报�?ping 最后一个活动会话�?

如果 rebase 失败,gateway 会中止并在不应用更新的情况下重启�?

更新(从源代码)

从仓�?checkout�?

首选:

openclaw update

手动(大致等价)�?

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

注意�?

  • 当你运行打包�?openclaw 二进制文件(openclaw.mjs)或使用 Node 运行 dist/ 时,pnpm build 很重要�?
  • 如果你从仓库 checkout 运行但没有全局安装,使�?pnpm openclaw … 进行 CLI 命令�?
  • 如果你直接从 TypeScript 运行(pnpm openclaw …),通常不需要重建,�?配置迁移仍然适用* �?运行 doctor�?
  • 在全局�?git 安装之间切换很容易:安装另一种风格,然后运行 openclaw doctor 以便 gateway 服务入口点被重写为当前安装�?

始终运行:openclaw doctor

Doctor �?安全更新”命令。它故意很无聊:修复 + 迁移 + 警告�?

注意:如果你�?源代码安�?(git checkout)上,openclaw doctor 会首先提供运�?openclaw update�?

它通常做的事情�?

  • 迁移已弃用的配置�?/ 旧配置文件位置�?
  • 审核 DM 策略并对风险�?开�?设置发出警告�?
  • 检�?Gateway 健康状况并可以提供重启�?
  • 检测并迁移较旧�?gateway 服务(launchd/systemd;旧�?schtasks)到当前 OpenClaw 服务�?
  • �?Linux 上,确保 systemd 用户 lingering(以�?Gateway 在注销后存活)�?

详情:Doctor

启动/停止/重启 Gateway

CLI(无论操作系统如何都能工作)�?

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

如果你在托管下:

  • macOS launchd(应用捆绑的 LaunchAgent):launchctl kickstart -k gui/$UID/ai.openclaw.gateway(使�?ai.openclaw.<profile>;旧�?com.openclaw.* 仍然有效�?
  • Linux systemd 用户服务:systemctl --user restart openclaw-gateway[-<profile>].service
  • Windows(WSL2):systemctl --user restart openclaw-gateway[-<profile>].service
    • launchctl/systemctl 仅在服务已安装时才有效;否则运行 openclaw gateway install�?

运行手册 + 确切的服务标签: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

如果你卡住了

  • 再次运行 openclaw doctor 并仔细阅读输出(它经常告诉你修复方法)�?
  • 检查:[故障排除](/zh/docs/gateway/troubleshooting�?
  • �?Discord 中提问:https://discord.gg/clawd