> 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.

Step 1 runs [Reset the CLI](https://docs.sonarsource.com/sonarqube-cli/administration/system-reset.md), which clears credentials, sensitive configuration values, binaries, integrations, and cached CLI files in one step. That command does not remove the `sonar` binary from your `PATH`. Steps 2 to 5 finish the uninstall.

## Step 1: Reset the CLI

To keep the CLI and remove only some integration features, do not run this step. See [Remove only some integrations](#remove-only-some-integrations) instead.

While the CLI binary is still available, run:

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

The command removes saved tokens and sensitive stored config values (proxy URLs and the client-certificate passphrase) from the keychain. It also removes integrations, auxiliary binaries, cached files, the local stats database, and your `sonar config` settings. The command asks you to type `RESET` to confirm. In a script or any session without an interactive terminal, add `--force` to skip the prompt.

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.

### Remove only some integrations

Use this option to keep the CLI and remove individual integration features. Skip Steps 2 to 5.

Re-run the matching `sonar integrate` command (for example, `sonar integrate claude`), choose **Customize**, and decline **Keep?** on the features you want to remove. See the instructions on [integrations/README.md](https://docs.sonarsource.com/sonarqube-cli/integrations/integrations.md#removing-installed-features) for more details.

## 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`, `~/.zprofile`, or `~/.profile`; the zsh files are in `$ZDOTDIR` if you set it) 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/`)
* Intended-architecture backups from `sonar architecture intended set` (`architecture/backups/`)
* Globally-installed Git hooks (from `sonar integrate git`)

## Step 4: Remove agent integrations

`sonar system reset --all` in Step 1 already removes the agent integrations that `sonar integrate` installed. Use this step if you skipped Step 1, or to clean up files that the CLI has no record of, such as files that an earlier CLI version left behind.

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

* 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. For Devin, remove the SonarQube hook entries from `config.json`, the managed snippets from `AGENTS.md`, and the `sonarqube` entry from `mcp_config.json` under `~/.config/devin/` (or `%APPDATA%\devin` on Windows). Leave your other Devin settings in place. For Pi, delete `~/.pi/agent/extensions/sonar-secrets.ts`, `sonar-sqaa.ts`, and `sonar-cag.ts`, and remove the `sonarqube` entry under `mcpServers` in `~/.pi/agent/mcp.json`. Leave your other Pi extensions and MCP servers in place.
* For Devin and Pi, see [Uninstall](https://docs.sonarsource.com/sonarqube-cli/integrations/devin.md#uninstall) on the Devin integration page and [Uninstall](https://docs.sonarsource.com/sonarqube-cli/integrations/pi.md#uninstall) on the Pi integration page.
* 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](https://docs.sonarsource.com/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`.

If you ran `sonar architecture install-skill`:

* `sonar system reset` leaves the skill in place. Delete the `sonar-architecture` folder inside `.claude/skills/` and `.agents/skills/` in the repository where you ran the command, or in your home directory if you used `--global`. Outside a Git repository, that is the folder where you ran the command.

## 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](https://docs.sonarsource.com/sonarqube-cli/administration/system-reset.md)
* [State and storage](https://docs.sonarsource.com/sonarqube-cli/administration/state-and-storage.md)
* [Updating the CLI](https://docs.sonarsource.com/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.
