Skip to content

卸载

两种路径:

  • 简单路径openclaw CLI 仍然可用时使用。
  • 手动移除服务:CLI 已不存在但服务仍在运行时使用。

简单路径(CLI 仍已安装)

推荐:使用内置卸载工具:

bash
openclaw uninstall

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

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

手动步骤(效果相同):

1. 停止 gateway 服务:

bash
openclaw gateway stop

2. 卸载 gateway 服务(launchd/systemd/schtasks):

bash
openclaw gateway uninstall

3. 删除状态 + 配置:

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

如果你把 OPENCLAW_CONFIG_PATH 设置为状态目录以外的自定义路径,记得也把那个文件一起删掉。

4. 删除工作区(可选,移除 agent 文件):

bash
rm -rf ~/.openclaw/workspace

5. 卸载 CLI(选择你当时安装时用的工具):

bash
npm rm -g openclaw
pnpm remove -g openclaw
bun remove -g openclaw

6. 如果你安装了 macOS 应用:

bash
rm -rf /Applications/OpenClaw.app

注意事项:

  • 如果你使用了配置文件(--profile / OPENCLAW_PROFILE),对每个状态目录重复第 3 步(默认路径为 ~/.openclaw-<profile>)。
  • 在远程模式下,状态目录在 gateway 宿主机上,因此也需要在那里执行第 1-4 步。

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

当 gateway 服务仍在运行但 openclaw 命令已不存在时使用。

macOS(launchd)

默认 label 为 ai.openclaw.gateway(或 ai.openclaw.<profile>;旧版 com.openclaw.* 可能还存在):

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

如果使用了配置文件,将 label 和 plist 名称替换为 ai.openclaw.<profile>。如果存在旧版 com.openclaw.* plist,一并删除。

Linux(systemd 用户单元)

默认单元名称为 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(计划任务)

默认任务名称为 OpenClaw Gateway(或 OpenClaw Gateway (<profile>))。任务脚本存放在状态目录下。

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

如果使用了配置文件,删除对应的任务名称和 ~\.openclaw-<profile>\gateway.cmd

普通安装 vs 源码检出

普通安装(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)。

源码检出(git clone)

如果你是通过仓库运行(git clone + openclaw ... / bun run openclaw ...):

  1. 删除仓库目录前先卸载 gateway 服务(使用上面的简单路径或手动移除服务步骤)。
  2. 删除仓库目录。
  3. 如上所示移除状态目录和工作区。