OpenClaw 中文文档 — 升级、迁移与卸载

装好了,用了一段时间。新版出了怎么更新?换机器怎么迁?不用了怎么清干净?三个问题,这篇全解决。

升级

最快的方式

重新跑安装脚本:

bash 复制代码
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard

自动检测现有安装,原地升级。

包管理器

bash 复制代码
npm i -g openclaw@latest
# 或
pnpm add -g openclaw@latest

源码安装

bash 复制代码
openclaw update

一条命令搞定 fetch + rebase + install + build + doctor + restart。

升级后必做

bash 复制代码
openclaw doctor           # 迁移配置、检查问题
openclaw gateway restart  # 重启网关
openclaw health           # 验证

openclaw doctor 很重要------它会自动迁移废弃的配置键,检查 DM 策略安全性。别跳过。

自动更新

默认关闭,想开的话:

json 复制代码
{
  "update": {
    "channel": "stable",
    "auto": { "enabled": true }
  }
}

切换频道:

bash 复制代码
openclaw update --channel beta
openclaw update --channel stable

回滚

bash 复制代码
# npm
npm i -g openclaw@<version>

# 源码(回到某个日期的状态)
git checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)"
pnpm install && pnpm build
openclaw gateway restart

迁移

本质上就是复制两个目录:

  • ~/.openclaw/ --- 状态(配置、认证、会话、渠道)
  • ~/.openclaw/workspace/ --- 工作区(Agent 文件、记忆)

操作流程

旧机器:

bash 复制代码
openclaw gateway stop
cd ~ && tar -czf openclaw-state.tgz .openclaw

新机器:

bash 复制代码
# 装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard

# 解压
cd ~ && tar -xzf openclaw-state.tgz

# 修复 + 启动
openclaw doctor
openclaw gateway restart

验证:openclaw status,检查渠道连接、历史会话、工作区文件。

注意

  • 别只复制 openclaw.json------凭据在 credentials/ 目录
  • 状态目录有 API Key 等敏感信息,传输要加密
  • 用了 --profile 的话,状态目录在 ~/.openclaw-<profile>/
  • 远程模式迁的是网关主机,不是你的笔记本

卸载

一条命令

bash 复制代码
openclaw uninstall

自动化版本:

bash 复制代码
openclaw uninstall --all --yes --non-interactive

手动清理

bash 复制代码
openclaw gateway stop
openclaw gateway uninstall
rm -rf ~/.openclaw
npm rm -g openclaw
# macOS 还要删应用
rm -rf /Applications/OpenClaw.app

CLI 已删但服务还在跑

macOS:

bash 复制代码
launchctl bootout gui/$UID/ai.openclaw.gateway
rm -f ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Linux:

bash 复制代码
systemctl --user disable --now openclaw-gateway.service
rm -f ~/.config/systemd/user/openclaw-gateway.service
systemctl --user daemon-reload

下一篇

CLI 入门与向导自动化。

完整中文文档:OpenClaw 中文文档

GitHub 仓库:openclaw/openclaw


OpenClaw 中文文档系列第四篇,后面会一篇篇写完。觉得有用点个赞,有问题评论区聊。

相关推荐
后端小肥肠17 小时前
我做了个能一键搭建个人工作台的 Skill,已开源
人工智能·aigc·agent
sg_knight17 小时前
ZCode 3.0 安装全攻略:下载、配置、跑通第一个任务
llm·agent·ai编程·coding·ai工具·智谱·zcode
5pat54OfCg18 小时前
OpenCode 源码拆解(五):AI 跑 rm -rf 怎么办?——命令执行的安全网
源码·agent
5pat54OfCg18 小时前
OpenCode 源码拆解(六):系统怎么不崩?——韧性的 3 个设计模式
agent·源码阅读
用户8471810541919 小时前
langchain.js中stream()的单模式 vs 多模式梳理
agent
鸿翼Macrowing20 小时前
**从一份 PDF 到一次 API 调用:企业 AI 能力的“最后一公里“**
人工智能·pdf·agent·数据治理·skill
阿里云云原生21 小时前
告别功能堆叠,迎接“对话即服务”:FinXScope AI 原生六层架构设计详解
agent
昵称好难啊1 天前
ClaudeCode: 怎么规划任务
llm·agent
京东云开发者1 天前
ICML 2026|NaviAgent:面向 Oxygen 智能体的可扩展工具编排
agent·ai编程
玉鸯1 天前
让 Agent 面向用户:AG-UI 协议构建 Agent 前端
前端·python·agent