Files
openclaw/docs/install/uninstall.md
Jason e74931778c fix: preserve workspaces during state-only uninstall
Preserve workspace directories when `openclaw uninstall --state` removes local state, including configured workspaces and implicit per-agent workspaces resolved by the runtime. State-only uninstall now uses a cleanup plan that keeps those workspace roots unless `--workspace` is selected.

Fixes #75052.

Proof:
- `git diff --check origin/main...HEAD`
- `pnpm exec oxfmt --check --threads=1 src/commands/cleanup-utils.ts src/commands/cleanup-utils.test.ts src/commands/uninstall.ts src/commands/uninstall.test.ts docs/cli/uninstall.md docs/install/uninstall.md`
- `node scripts/run-vitest.mjs src/commands/uninstall.test.ts src/commands/cleanup-utils.test.ts src/commands/reset.test.ts src/commands/agents.delete.test.ts`
- `node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile /tmp/openclaw-pr75061-core-test-final-rebase2.tsbuildinfo`
- `pnpm docs:list`
- `node scripts/check-docs-mdx.mjs docs/cli/uninstall.md docs/install/uninstall.md`
- `.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main`
- CI: https://github.com/openclaw/openclaw/actions/runs/26721260691

Co-authored-by: Jason-Bai <boybai.work@gmail.com>
2026-05-31 19:54:34 +01:00

3.6 KiB

summary, read_when, title
summary read_when title
Uninstall OpenClaw completely (CLI, service, state, workspace)
You want to remove OpenClaw from a machine
The gateway service is still running after uninstall
Uninstall

Two paths:

  • Easy path if openclaw is still installed.
  • Manual service removal if the CLI is gone but the service is still running.

Easy path (CLI still installed)

Recommended: use the built-in uninstaller:

openclaw uninstall

When using the CLI, state removal preserves configured workspace directories unless you also select --workspace.

Non-interactive (automation / npx):

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

Manual steps (same result):

  1. Stop the gateway service:
openclaw gateway stop
  1. Uninstall the gateway service (launchd/systemd/schtasks):
openclaw gateway uninstall
  1. Delete state + config:
rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"

If you set OPENCLAW_CONFIG_PATH to a custom location outside the state dir, delete that file too. If you want to keep a workspace inside the state dir, such as ~/.openclaw/workspace, move it aside before running rm -rf or delete state contents selectively.

  1. Delete your workspace (optional, removes agent files):
rm -rf ~/.openclaw/workspace
  1. Remove the CLI install (pick the one you used):
npm rm -g openclaw
pnpm remove -g openclaw
bun remove -g openclaw
  1. If you installed the macOS app:
rm -rf /Applications/OpenClaw.app

Notes:

  • If you used profiles (--profile / OPENCLAW_PROFILE), repeat step 3 for each state dir (defaults are ~/.openclaw-<profile>).
  • In remote mode, the state dir lives on the gateway host, so run steps 1-4 there too.

Manual service removal (CLI not installed)

Use this if the gateway service keeps running but openclaw is missing.

macOS (launchd)

Default label is ai.openclaw.gateway (or ai.openclaw.<profile>; legacy com.openclaw.* may still exist):

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

If you used a profile, replace the label and plist name with ai.openclaw.<profile>. Remove any legacy com.openclaw.* plists if present.

Linux (systemd user unit)

Default unit name is openclaw-gateway.service (or 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)

Default task name is OpenClaw Gateway (or OpenClaw Gateway (<profile>)). The task script lives under your state dir.

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

If you used a profile, delete the matching task name and ~\.openclaw-<profile>\gateway.cmd.

Normal install vs source checkout

Normal install (install.sh / npm / pnpm / bun)

If you used https://openclaw.ai/install.sh or install.ps1, the CLI was installed with npm install -g openclaw@latest. Remove it with npm rm -g openclaw (or pnpm remove -g / bun remove -g if you installed that way).

Source checkout (git clone)

If you run from a repo checkout (git clone + openclaw ... / bun run openclaw ...):

  1. Uninstall the gateway service before deleting the repo (use the easy path above or manual service removal).
  2. Delete the repo directory.
  3. Remove state + workspace as shown above.