卸载

卸载

两条路径:

  • 简单路径:如果 openclaw 仍然安装。
  • 手动服务移除:如果 CLI 已消失但服务仍在运行。

简单路径(CLI 仍安装)

推荐:使用内置卸载程序:

openclaw uninstall

非交互式(自动化 / npx):

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

手动步骤(相同结果):

  1. 停止 gateway 服务:
openclaw gateway stop
  1. 卸载 gateway 服务(launchd/systemd/schtasks):
openclaw gateway uninstall
  1. 删除状态 + 配置:
rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"

如果将 OPENCLAW_CONFIG_PATH 设置为状态目录外的自定义位置,也删除该文件。

  1. 删除你的工作区(可选,移除 agent 文件):
rm -rf ~/.openclaw/workspace
  1. 移除 CLI 安装(选择你使用的):
npm rm -g openclaw
pnpm remove -g openclaw
bun remove -g openclaw
  1. 如果安装了 macOS 应用:
rm -rf /Applications/OpenClaw.app

注意事项:

  • 如果使用 profiles(--profile / OPENCLAW_PROFILE),对每个状态目录重复步骤 3(默认是 ~/.openclaw-<profile>)。
  • 在远程模式下,状态目录位于gateway 主机上,因此也在那里运行步骤 1-4。

手动服务移除(CLI 未安装)

如果 gateway 服务继续运行但 openclaw 缺失,使用此方法。

macOS(launchd)

默认标签是 ai.openclaw.gateway(或 ai.openclaw.<profile>;旧版 com.openclaw.* 可能仍然存在):

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

如果使用 profile,将标签和 plist 名称替换为 ai.openclaw.<profile>。如果存在,移除任何旧版 com.openclaw.* plists。

Linux(systemd 用户单元)

默认单元名称是 openclaw-gateway.service(或 openclaw-gateway-<profile>.service):

systemctl --user disable --now openclaw-gateway.service
rm -f ~/.config/systemd/user/openclaw-gateway.service
systemctl --user daemon-reload

Windows(计划任务)

默认任务名称是 OpenClaw Gateway(或 OpenClaw Gateway (<profile>))。 任务脚本位于你的状态目录下。

schtasks /Delete /F /TN "OpenClaw Gateway"
Remove-Item -Force "$env:USERPROFILE\.openclaw\gateway.cmd"

如果使用 profile,删除匹配的任务名称和 ~\.openclaw-<profile>\gateway.cmd

正常安装 vs 源码 checkout

正常安装(install.sh / npm / pnpm / bun)

如果使用 https://openclaw.ai/install.shinstall.ps1,CLI 通过 npm install -g openclaw@latest 安装。 使用 npm rm -g openclaw 移除(或 pnpm remove -g / bun remove -g,如果你这样安装)。

源码 checkout(git clone)

如果从 repo checkout 运行(git clone + openclaw ... / bun run openclaw ...):

  1. 在删除 repo 之前卸载 gateway 服务(使用上面的简单路径或手动服务移除)。
  2. 删除 repo 目录。
  3. 如上所示删除状态 + 工作区。