> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-cli/administration/uninstall.md).

# Uninstalling

Remove the SonarQube CLI binary, state, credentials, and integrations from your machine.

The SonarQube CLI installs itself in a few well-defined locations, and removing it's a matter of deleting them in order.

To clear credentials, binaries, integrations, and cached CLI files in one step, run [Reset the CLI](/sonarqube-cli/administration/system-reset.md) first. That command does not remove the `sonar` binary from your `PATH`. Use the steps below for a full uninstall.

## Step 1: Clear saved tokens and configuration values from the keychain

While the CLI binary is still available, remove saved tokens and sensitive stored config values (proxy URLs and the client-certificate passphrase) from the keychain:

```bash
sonar system reset --all
```

If you already ran this command above, skip this step.

If you've already removed the CLI or `state.json` and need to clean up afterwards, open your OS keychain manually and remove every entry whose service name is `sonarqube-cli`, including the `config/<key>` accounts.

## Step 2: Remove the binary and PATH entry

If you installed via Homebrew:

```bash
brew uninstall sonarqube-cli
```

This removes the binary and its `PATH` entry automatically. Skip to [Step 3](#step-3-remove-cli-state-and-auxiliary-binaries).

If you installed via Mise:

```bash
mise use -g --remove sonarqube-cli
mise uninstall --all sonarqube-cli
```

Skip to [Step 3](#step-3-remove-cli-state-and-auxiliary-binaries).

For install-script installs, continue below.

{% tabs %}
{% tab title="MACOS, LINUX" %}

```bash
rm -rf ~/.local/share/sonarqube-cli
```

Then edit your shell profile (`~/.bashrc`, `~/.zshrc`, `~/.bash_profile`, or `~/.profile`) and remove this line:

```bash
export PATH="$HOME/.local/share/sonarqube-cli/bin:$PATH"
```

Reload your shell (`source ~/.bashrc` or open a new terminal) to drop the `sonar` command from your `PATH`.
{% endtab %}

{% tab title="WINDOWS (POWERSHELL)" %}
Delete the install directory:

```powershell
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\sonarqube-cli"
```

Then remove the install path from your user `PATH`:

1. Open **System Properties** > **Environment Variables**.
2. Edit the user-level `Path` variable.
3. Remove the entry pointing to `…\sonarqube-cli\bin`.
4. Sign out and back in (or open a new PowerShell session) for the change to take effect.
   {% endtab %}
   {% endtabs %}

## Step 3: Remove CLI state and auxiliary binaries

```bash
rm -rf ~/.sonar/sonarqube-cli
```

This wipes:

* `state.json` (your active connection and integration registry)
* `cli-config.properties` (including `telemetry.enabled` and `stats.enabled`)
* Auxiliary scanner binaries
* CLI logs
* Local stats database (`db/stats/`)
* Globally-installed Git hooks (from `sonar integrate git`)

## Step 4: Remove agent integrations

To remove individual integration features interactively, re-run the matching `sonar integrate` command (for example, `sonar integrate claude`) and decline **Keep?** on the features you want to remove. See [integrations/README.md](/sonarqube-cli/integrations/integrations.md#removing-installed-features).

If you ran `sonar integrate claude`, `sonar integrate copilot`, `sonar integrate codex`, `sonar integrate cursor`, or `sonar integrate opencode`:

* Delete the SonarQube hook files inside `~/.claude/`, `~/.copilot/`, `~/.cursor/`, or `~/.codex/`, and remove the SonarQube MCP server entry from your agent configuration. For OpenCode, delete `~/.config/opencode/plugins/sonar-secrets.ts`, `~/.config/opencode/plugins/sonar-sqaa.ts`, and `~/.config/opencode/skills/sonar-context-augmentation/SKILL.md`. Remove the managed Vortex snippets from `~/.config/opencode/AGENTS.md`, and remove the `sonarqube` entry under `mcp` in `~/.config/opencode/opencode.json`. If an earlier CLI left `~/.config/opencode/plugins/sonar.ts`, delete that file too.
* If an earlier CLI version installed project-scoped files and they're still in the repository, also delete the SonarQube-related files inside your repo's agent configuration directory (`.claude/`, Copilot config, `.cursor/`, or Codex config). A successful upgrade already removes those files when it migrates the integration to global scope (see [Migrate project-scoped agent integrations](/sonarqube-cli/administration/self-update.md#migrate-project-scoped-agent-integrations)).

If you ran `sonar integrate git`:

* Unset the global hooks path with `git config --global --unset core.hooksPath` and delete `~/.sonar/sonarqube-cli/hooks/` (handled by Step 3 if you removed `~/.sonar/sonarqube-cli`).
* If you used `--local`, or an earlier CLI version installed per-repo hooks, also delete `.git/hooks/pre-commit` and `.git/hooks/pre-push` if they were installed by the CLI, or remove the SonarQube entry from your Husky scripts or `.pre-commit-config.yaml`.

## Step 5: Verify the removal

```bash
which sonar          # should return nothing
ls ~/.sonar          # should not contain sonarqube-cli
```

## Related pages <a href="#related-pages" id="related-pages"></a>

* [Reset the CLI](/sonarqube-cli/administration/system-reset.md)
* [State and storage](/sonarqube-cli/administration/state-and-storage.md)
* [Updating the CLI](/sonarqube-cli/administration/self-update.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-cli/administration/uninstall.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
