Uninstall OpenClaw: CLI, Service, State, and Workspace

This page explains how to completely uninstall OpenClaw, including the CLI, service, state, and workspace. It covers both the easy path when the CLI is still installed and manual removal for when it is not.

Read this when

  • You want to remove OpenClaw from a machine
  • The gateway service is still running after uninstall

Two options are available:

  • Easy path when openclaw is still present on the system.
  • Manual service removal for cases where the CLI has been removed but the service continues to operate.

Easy path (CLI still installed)

The uninstaller tries each requested cleanup scope on its own and exits with a nonzero code if any scope fails or gets blocked. Service teardown acts as the safeguard for state and workspace deletion; when that safeguard fails, those data scopes stay untouched while app cleanup still proceeds. Any partial cleanup is called out clearly, and a full success result is never reported after an incomplete run.

The recommended approach is to rely on the built-in uninstaller:

openclaw uninstall

Configured workspace directories are left intact during state removal unless --workspace is also chosen.

To see what would be removed without actually deleting anything (safe to run):

openclaw uninstall --dry-run --all

For non-interactive use (automation or npx). Proceed with care, and only after verifying the scopes:

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

The flags --service, --state, --workspace, and --app each target a single scope; --all covers all four at once.

The manual steps give you a full removal route, yet simply deleting the state directory lacks the workspace-preservation logic that the built-in uninstaller provides. To match what openclaw uninstall --state does, keep every configured workspace intact before wiping the state.

  1. Halt the gateway service:
openclaw gateway stop
  1. Remove the gateway service (via launchd, systemd, or schtasks):
openclaw gateway uninstall
  1. Choose whether the workspace should be kept.

openclaw uninstall --state intentionally leaves configured workspace directories alone, including the default ~/.openclaw/workspace. Prior to running the manual rm -rf shown below, relocate any workspace you wish to retain so it sits outside the state directory. If you want it gone as well, no extra deletion step is required when it resides inside the state directory.

  1. Wipe state and config:
rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"

If OPENCLAW_CONFIG_PATH points to a custom path outside the state dir, that file also needs to be deleted. After recreating the parent directory, either restore any preserved workspace to its configured location or adjust the workspace path in your next installation.

  1. Only if you want to get rid of the agent files, delete a workspace that lives outside the state directory:
rm -rf /path/to/external/workspace
  1. Uninstall the CLI using the method you originally chose:
npm rm -g openclaw
pnpm remove -g openclaw
bun remove -g openclaw
  1. If the macOS app was installed:
rm -rf /Applications/OpenClaw.app

Additional notes:

  • When profiles are in use (--profile / OPENCLAW_PROFILE), go through steps 3-4 for every state dir (the defaults are ~/.openclaw-<profile>).
  • In remote mode, the state dir is located on the gateway host, so steps 1-4 must also be executed there.

Manual service removal (CLI not installed)

This applies when the gateway service remains active but openclaw is not present.

macOS (launchd)

The default label is ai.openclaw.gateway (or ai.openclaw.<profile> when a profile is used):

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

With a profile, swap in ai.openclaw.<profile> for the label and plist name.

Linux (systemd user unit)

The default unit name is openclaw-gateway.service (or openclaw-gateway-<profile>.service). Systems upgraded from older installations may still carry a pre-rename clawdbot-gateway.service unit; openclaw uninstall / openclaw gateway uninstall finds and removes it on its own.

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

Windows (Scheduled Task)

The default task name is OpenClaw Gateway (or OpenClaw Gateway (<profile>)). That task starts a windowless gateway.vbs script from your state dir, and that script then invokes gateway.cmd; both need to be removed.

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

For profile-based setups, remove the matching task name along with the gateway.cmd / gateway.vbs files located under ~\.openclaw-<profile>.

Normal install vs source checkout

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

If https://openclaw.ai/install.sh or install.ps1 was used, the CLI came via npm install -g openclaw@latest. Uninstall it with npm rm -g openclaw (or pnpm remove -g / bun remove -g for those installation methods).

Source checkout (git clone)

When running from a repo checkout (git clone combined with openclaw ... / bun run openclaw ...):

  1. Make sure the gateway service is removed prior to deleting the repository (either follow the straightforward method mentioned earlier or uninstall the service manually).
  2. Remove the repository folder.
  3. Clear out the state and workspace as demonstrated previously.
784 words · updated Aug 25, 2026