> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compressi.us/llms.txt
> Use this file to discover all available pages before exploring further.

# Uninstall and Purge CMX on Linux, macOS, and Windows

> Complete guide to removing CMX: restore coding-agent routing, stop the gateway, wipe all data, and verify nothing is left behind on any platform.

CMX ships a full-purge procedure for each supported platform. This page walks you through restoring your coding agents to their original configuration, stopping the CMX gateway, and removing every trace of CMX, including processes, auto-start services, credentials, configuration, session history, cached state, and both standalone and package-manager installs.

<Warning>
  A full purge permanently deletes all local CMX data and preferences. It does not delete your Codex, OpenCode, or AI-provider accounts.
</Warning>

## Before Removing CMX

Restore your coding agents' original connection settings while the CMX executable and its routing backups are still available.

<Steps>
  <Step title="Restore agent connections">
    ```bash theme={null}
    cmx harness disable
    ```

    Restart Codex and OpenCode after this command. If CMX reports that no supported agent is configured, continue. If it reports that it refused to restore an edited configuration, stop and resolve that error before purging. Otherwise the coding agent may keep pointing at the removed local gateway.
  </Step>

  <Step title="Sign out and stop the gateway">
    ```bash theme={null}
    cmx logout
    cmx stop
    ```
  </Step>
</Steps>

<Warning>
  Never add `|| true` to `cmx harness disable`. A genuine restoration failure needs attention before CMX is deleted.
</Warning>

## Complete Purge

Choose the tab for your operating system and run the commands as the same user that installed CMX.

<Tabs>
  <Tab title="Linux">
    Run as your normal desktop user:

    ```bash theme={null}
    cmx harness disable
    cmx logout
    cmx stop

    systemctl --user disable --now cmx.service 2>/dev/null || true
    rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/cmx.service"
    systemctl --user daemon-reload
    systemctl --user reset-failed
    pkill -x cmx 2>/dev/null || true

    if command -v npm >/dev/null 2>&1; then
      npm uninstall --global @compressius/cmx || true
    fi
    if command -v pnpm >/dev/null 2>&1; then
      pnpm remove --global @compressius/cmx || true
    fi

    sudo rm -f /usr/local/bin/cmx /usr/bin/cmx
    rm -f "$HOME/.local/bin/cmx"

    rm -rf \
      "${XDG_CONFIG_HOME:-$HOME/.config}/cmx" \
      "${XDG_DATA_HOME:-$HOME/.local/share}/cmx" \
      "${XDG_STATE_HOME:-$HOME/.local/state}/cmx"

    hash -r
    ```

    **Verify the purge:**

    ```bash theme={null}
    if command -v cmx >/dev/null 2>&1; then
      echo "CMX is still installed at: $(command -v cmx)"
    else
      echo "CMX executable removed"
    fi

    if systemctl --user list-unit-files cmx.service --no-legend 2>/dev/null | grep -q cmx; then
      echo "CMX systemd service still exists"
    else
      echo "CMX systemd service removed"
    fi

    if pgrep -x cmx >/dev/null; then
      echo "A CMX process is still running"
    else
      echo "No CMX process is running"
    fi
    ```
  </Tab>

  <Tab title="Mac">
    First restore routing and stop CMX:

    ```bash theme={null}
    cmx harness disable
    cmx logout
    cmx stop
    ```

    Then remove package-manager and standalone installs:

    ```bash theme={null}
    pkill -x cmx 2>/dev/null || true

    if command -v npm >/dev/null 2>&1; then
      npm uninstall --global @compressius/cmx || true
    fi
    if command -v pnpm >/dev/null 2>&1; then
      pnpm remove --global @compressius/cmx || true
    fi

    sudo rm -f /usr/local/bin/cmx /opt/homebrew/bin/cmx
    rm -f "$HOME/.local/bin/cmx"

    rm -rf "$HOME/Library/Application Support/cmx"

    hash -r
    ```

    <Note>
      CMX does not install a macOS launchd service automatically. If you created one manually, unload and delete only the exact plist you created. Replace `YOUR-CMX-SERVICE.plist` with your real filename; do not delete unrelated LaunchAgent files.
    </Note>

    ```bash theme={null}
    launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/YOUR-CMX-SERVICE.plist" 2>/dev/null || true
    rm -f "$HOME/Library/LaunchAgents/YOUR-CMX-SERVICE.plist"
    ```

    **Verify the purge:**

    ```bash theme={null}
    if command -v cmx >/dev/null 2>&1; then
      echo "CMX is still installed at: $(command -v cmx)"
    else
      echo "CMX executable removed"
    fi

    if pgrep -x cmx >/dev/null; then
      echo "A CMX process is still running"
    else
      echo "No CMX process is running"
    fi
    ```
  </Tab>

  <Tab title="Windows">
    Open PowerShell as the same Windows user that installed CMX. Restore coding-agent routing first, and stop if it reports a real restoration error:

    ```powershell theme={null}
    cmx harness disable
    cmx logout
    cmx stop
    ```

    Then remove processes, packages, files, PATH entry, and shortcut:

    ```powershell theme={null}
    Get-Process -Name cmx -ErrorAction SilentlyContinue |
        Stop-Process -Force

    if (Get-Command npm -ErrorAction SilentlyContinue) {
        npm uninstall --global @compressius/cmx
    }
    if (Get-Command pnpm -ErrorAction SilentlyContinue) {
        pnpm remove --global @compressius/cmx
    }

    $cmxInstallDir = Join-Path $env:LOCALAPPDATA 'CMX\bin'
    $cmxLocalData  = Join-Path $env:LOCALAPPDATA 'cmx'
    $cmxConfig     = Join-Path $env:APPDATA 'cmx'
    $cmxShortcut   = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs\CMX.lnk'

    Remove-Item -LiteralPath $cmxLocalData -Recurse -Force -ErrorAction SilentlyContinue
    Remove-Item -LiteralPath $cmxConfig    -Recurse -Force -ErrorAction SilentlyContinue
    Remove-Item -LiteralPath $cmxShortcut  -Force -ErrorAction SilentlyContinue

    $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
    if ($userPath) {
        $cleanPath = (($userPath -split ';') | Where-Object {
            $_ -and $_.TrimEnd('\') -ine $cmxInstallDir.TrimEnd('\')
        }) -join ';'
        [Environment]::SetEnvironmentVariable('Path', $cleanPath, 'User')
    }

    Remove-Item Alias:cmx -ErrorAction SilentlyContinue
    ```

    <Note>
      CMX does not install a Windows service or scheduled task automatically. If you created one manually, remove only the CMX entry you created.
    </Note>

    For a service named `cmx`:

    ```powershell theme={null}
    $service = Get-Service -Name cmx -ErrorAction SilentlyContinue
    if ($service) {
        Stop-Service -Name cmx -Force -ErrorAction SilentlyContinue
        sc.exe delete cmx
    }
    ```

    For a scheduled task named `CMX`:

    ```powershell theme={null}
    $task = Get-ScheduledTask -TaskName CMX -ErrorAction SilentlyContinue
    if ($task) {
        Unregister-ScheduledTask -TaskName CMX -Confirm:$false
    }
    ```

    Close PowerShell and open a new window so the updated PATH takes effect.

    **Verify the purge:**

    ```powershell theme={null}
    if (Get-Command cmx -ErrorAction SilentlyContinue) {
        Write-Host "CMX is still installed at:"
        Get-Command cmx | Select-Object -ExpandProperty Source
    } else {
        Write-Host "CMX executable removed"
    }

    if (Get-Process -Name cmx -ErrorAction SilentlyContinue) {
        Write-Host "A CMX process is still running"
    } else {
        Write-Host "No CMX process is running"
    }
    ```
  </Tab>
</Tabs>

## Reinstall CMX

<CodeGroup>
  ```bash Linux / macOS theme={null}
  curl -sSfL https://compressi.us/install.sh | sh
  ```

  ```powershell Windows theme={null}
  Invoke-WebRequest -UseBasicParsing 'https://compressi.us/install.ps1' -OutFile "$env:TEMP\cmx-install.ps1"
  powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\cmx-install.ps1"
  ```

  ```bash npm theme={null}
  npm install --global @compressius/cmx
  ```

  ```bash pnpm theme={null}
  pnpm add --global @compressius/cmx
  ```
</CodeGroup>

After reinstalling, restart your coding agent and verify the full path:

```bash theme={null}
cmx --version
cmx doctor
cmx harness verify
cmx status
```

Then send a real request through Codex or OpenCode and confirm CMX recorded it:

```bash theme={null}
cmx stats
```

<Tip>
  A healthy status endpoint or successful setup alone does not prove that coding-agent traffic is flowing through CMX. A real request followed by new activity in `cmx stats` is the relevant check.
</Tip>


## Related topics

- [Install CMX on Linux, macOS, or Windows — All Methods](/installation.md)
- [CMX CLI Reference: All Commands, Flags, and Examples](/cli-reference.md)
- [How to Update CMX to the Latest Stable or Nightly Build](/updates.md)
