Skip to content

卸载

两条路径:

  • 如果 openclaw CLI 仍在:走简单路径
  • 如果 CLI 已不存在但 service 仍在跑:走手动移除 service

简单路径(CLI 仍已安装)

推荐:使用内置卸载器:

bash
openclaw uninstall

非交互(自动化 / npx):

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

手动步骤(效果相同):

  1. 停掉 gateway service:
bash
openclaw gateway stop
  1. 卸载 gateway service(launchd/systemd/schtasks):
bash
openclaw gateway uninstall
  1. 删除 state + config:
bash
rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"

如果你将 OPENCLAW_CONFIG_PATH 指向了 state 目录之外的自定义位置,也需要删除那个文件。

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

备注:

  • 如果你使用了 profiles(--profile / OPENCLAW_PROFILE),请对每个 state dir 重复第 3 步(默认是 ~/.openclaw-<profile>)。
  • 在 remote mode 下,state dir 位于gateway host 上,因此第 1-4 步也要在 gateway host 上执行。

手动移除 service(CLI 未安装)

当 gateway service 一直在跑但 openclaw 已不存在时使用。

macOS(launchd)

默认 label 为 bot.molt.gateway(或 bot.molt.<profile>;legacy com.openclaw.* 可能仍存在):

bash
launchctl bootout gui/$UID/bot.molt.gateway
rm -f ~/Library/LaunchAgents/bot.molt.gateway.plist

如果你使用了 profile,请将 label 与 plist 名替换为 bot.molt.<profile>,并在存在时删除任何 legacy com.openclaw.* plists。

Linux(systemd user unit)

默认 unit name 为 openclaw-gateway.service(或 openclaw-gateway-<profile>.service):

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

Windows(Scheduled Task)

默认 task 名为 OpenClaw Gateway(或 OpenClaw Gateway (<profile>))。 task script 位于你的 state dir 下。

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

如果你使用了 profile,请删除匹配的 task name 与 ~\.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 service(使用上面的简单路径或手动移除 service)。
  2. 删除 repo 目录。
  3. 按上面步骤删除 state + workspace。