BetaDeveloper

Uninstalling

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

Warning: This product is in Beta stage and we may release breaking changes.

The SonarQube CLI has no single uninstall command. The SonarQube CLI installs itself in a few well-defined locations, and removing it is a matter of deleting them in order.

Step 1: Clear saved tokens from the keychain

While the CLI binary is still available, log out of the saved connection:

sonar auth logout

If you've already removed the CLI or state.json and need to clean up tokens afterwards, open your OS keychain manually and remove every entry whose service name is sonarqube-cli.

Step 2: Remove the binary and PATH entry

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

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

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.

Step 3: Remove CLI state and auxiliary binaries

rm -rf ~/.sonar/sonarqube-cli

This wipes:

  • state.json (your active connection, telemetry preferences, integration registry)

  • Auxiliary scanner binaries

  • CLI logs

  • Globally-installed Git hooks (from sonar integrate git --global)

Step 4: Remove agent integrations

If you ran sonar integrate claude, sonar integrate copilot, or sonar integrate codex:

  • Global installs: delete the SonarQube hook files inside ~/.claude/, ~/.copilot/, or ~/.codex/, and remove the SonarQube MCP server entry from your agent configuration.

  • Project installs: delete the SonarQube-related files inside your repo's agent configuration directory (.claude/, Copilot config, or Codex config).

If you ran sonar integrate git:

  • Per-repo (plain Git hooks): delete .git/hooks/pre-commit and .git/hooks/pre-push if they were installed by the CLI.

  • Per-repo (Husky or pre-commit framework): remove the SonarQube entry from your Husky scripts or .pre-commit-config.yaml.

  • Globally: git config --global --unset core.hooksPath and delete ~/.sonar/sonarqube-cli/hooks/ (handled by Step 2 if you removed ~/.sonar/sonarqube-cli).

Step 5: Verify the removal

Last updated

Was this helpful?