如何在 Mac 上卸载 OpenClaw

分步指南:在 macOS 上彻底卸载 OpenClaw —— 移除应用、网关服务、配置文件、缓存,并验证清理干净。
2026/03/13

第一步:打开终端

按键盘上的 Command + Space(空格键),在搜索框输入 Terminal终端,然后按回车。

第二步:快速卸载(CLI 仍可用)

如果 openclaw 命令还能用,运行:

openclaw uninstall --all --yes
  • uninstall:告诉程序「我要卸载」。
  • --all:彻底删除,包括网关服务、本地数据库、配置文件等所有数据。
  • --yes:全程自动确认,不需要手动按 Y。

完全无交互模式(脚本/CI/npx):

openclaw uninstall --all --yes --non-interactive
npx -y openclaw uninstall --all --yes --non-interactive

第三步:删除命令行工具

上面的指令跑完后,电脑里只剩 OpenClaw 的外壳(CLI 工具)。用你当初安装时的包管理器删除它:

npm rm -g openclaw
# 或者
pnpm remove -g openclaw
# 或者
bun remove -g openclaw

第四步:删除 macOS 应用(如果装过)

rm -rf /Applications/OpenClaw.app

第五步:手动移除服务(CLI 已不在)

如果 openclaw 命令已经不存在,但网关服务还在后台运行:

launchctl bootout gui/$UID/ai.openclaw.gateway
rm -f ~/Library/LaunchAgents/ai.openclaw.gateway.plist

如果你用过 profile(--profile),把 gateway 替换成你的 profile 名。同时检查是否有旧版 com.openclaw.* plist 残留:

ls ~/Library/LaunchAgents/ | grep -i openclaw

第六步:删除状态、配置和工作区

rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"
rm -rf ~/.openclaw/workspace

如果你把 OPENCLAW_CONFIG_PATH 设到了状态目录以外的位置,也需要手动删除。如果你用过 profile,对每个状态目录重复操作(如 ~/.openclaw-<profile>)。

第七步:排查常见 Mac 残留

类别检查位置
应用支持目录~/Library/Application Support/openclaw
缓存~/Library/Caches/openclaw
日志~/Library/Logs/openclaw
偏好设置~/Library/Preferences~/Library/Saved Application State
隐藏目录~/.config/openclaw~/.local

第八步:检查 shell 配置改动

如果 OpenClaw 修改过你的终端配置,请检查并清理:

  • ~/.zshrc
  • ~/.zprofile
  • ~/.bash_profile
  • ~/.bashrc

移除所有 OPENCLAW_* 环境变量、PATH 条目,以及引用 OpenClaw 的 source 行。

第九步:重启并验证

  1. 清空废纸篓。
  2. 重启 Mac。
  3. 打开终端运行:
which openclaw
ps aux | grep openclaw
launchctl list | grep -i openclaw

三条命令都应该没有返回结果。

注意事项

  • 建议重启 —— 清理完成后重启电脑,确保所有后台进程彻底关闭。
  • 废弃旧 API Key —— 如果你在 OpenClaw 里绑定过 API Key(如 OpenAI、Claude 的密钥),强烈建议去对应官网废弃旧 Key,生成新的 Key,以防万一。
  • 远程模式 —— 如果你用过远程模式,状态目录在网关主机上,需要在那台机器上也执行清理步骤。

如何在 Mac 上卸载 OpenClaw