维护

卸载

两种方式:

  • 如果 openclaw 仍已安装,使用简便方式
  • 如果 CLI 已不存在但服务仍在运行,使用手动移除服务

简便方式(CLI 仍已安装)

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

bash
openclaw uninstall

移除状态数据时会保留已配置的工作区目录,除非你同时选择 --workspace

预览将要移除的内容(安全):

bash
openclaw uninstall --dry-run --all

非交互式(自动化 / npx)。请谨慎使用,并且仅在确认作用范围后使用:

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

标志:--service--state--workspace--app 分别选择各个作用范围;--all 选择全部四项。

手动步骤(结果相同):

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

如果你将 OPENCLAW_CONFIG_PATH 设置为状态目录之外的自定义位置,也请删除该文件。 如果你想保留状态目录内的工作区(例如 ~/.openclaw/workspace),请在运行 rm -rf 前将其移到其他位置,或有选择地删除状态目录中的内容。

  1. 删除你的工作区(可选,会移除智能体文件):
bash
rm -rf ~/.openclaw/workspace
  1. 移除 CLI 安装(选择你曾使用的方式):
bash
npm rm -g openclawpnpm remove -g openclawbun remove -g openclaw
  1. 如果你安装了 macOS 应用:
bash
rm -rf /Applications/OpenClaw.app

注意:

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

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

如果 Gateway 网关服务仍在运行,但 openclaw 已不存在,请使用此方式。

macOS(launchd)

默认标签为 ai.openclaw.gateway(使用配置文件时为 ai.openclaw.<profile>):

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

如果你使用了配置文件,请将标签和 plist 文件名替换为 ai.openclaw.<profile>

Linux(systemd 用户单元)

默认单元名称为 openclaw-gateway.service(或 openclaw-gateway-<profile>.service)。从非常旧的安装升级而来的计算机上,可能仍存在重命名前的 clawdbot-gateway.service 单元;openclaw uninstall / openclaw gateway uninstall 会自动检测并移除它。

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

Windows(计划任务)

默认任务名称为 OpenClaw Gateway(或 OpenClaw Gateway (<profile>))。 该任务会启动状态目录下不显示窗口的 gateway.vbs 脚本,后者再运行 gateway.cmd;请将两者都删除。

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

如果你使用了配置文件,请删除对应名称的任务,以及 ~\.openclaw-<profile> 下的 gateway.cmd / gateway.vbs 文件。

常规安装与源代码检出

常规安装(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. 按照上面的说明移除状态数据和工作区。

相关内容

Was this useful?
On this page

On this page