移除
兩種方式:
- 簡易方式 —
openclaw仍已安裝時。 - 手動移除服務 — CLI 已移除但服務仍在執行時。
簡易方式(CLI 仍已安裝)
推薦:使用內建移除工具:
openclaw uninstall
非互動模式(自動化 / npx):
openclaw uninstall --all --yes --non-interactive
npx -y openclaw uninstall --all --yes --non-interactive
手動步驟(同樣結果):
- 停止閘道服務:
openclaw gateway stop
- 移除閘道服務(launchd/systemd/schtasks):
openclaw gateway uninstall
- 刪除狀態 + 設定:
rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"
如果你將 OPENCLAW_CONFIG_PATH 設定到狀態目錄之外的位置,也要刪除該檔案。
- 刪除 workspace(選用,會移除 agent 檔案):
rm -rf ~/.openclaw/workspace
- 移除 CLI 安裝(選擇你使用的方式):
npm rm -g openclaw
pnpm remove -g openclaw
bun remove -g openclaw
- 如果安裝了 macOS 應用程式:
rm -rf /Applications/OpenClaw.app
備註:
- 如果使用了 profile(
--profile/OPENCLAW_PROFILE),對每個狀態目錄重複步驟 3(預設為~/.openclaw-<profile>)。 - 在 remote 模式下,狀態目錄位於閘道主機上,因此步驟 1-4 也需要在那裡執行。
手動移除服務(CLI 未安裝)
當閘道服務持續執行但 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.* plist。
Linux (systemd user unit)
預設 unit 名稱為 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 (Scheduled Task)
預設工作名稱為 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.sh 或 install.ps1,CLI 是透過 npm install -g openclaw@latest 安裝的。
用 npm rm -g openclaw(或 pnpm remove -g / bun remove -g)移除。
原始碼 checkout(git clone)
如果從儲存庫 checkout 執行(git clone + openclaw ... / bun run openclaw ...):
- 在刪除儲存庫之前先移除閘道服務(使用上述簡易方式或手動移除)。
- 刪除儲存庫目錄。
- 如上所述移除狀態 + workspace。