For the complete documentation index, see llms.txt. This page is also available as Markdown.
Developer

Reset the CLI

Reset the SonarQube CLI to factory defaults with sonar system reset, removing tokens, binaries, integrations, and cached files.

sonar system reset returns the CLI to a factory-like state in one command. It removes saved tokens, auxiliary binaries, integration state, and cached files under ~/.sonar/sonarqube-cli. Your telemetry preference in state.json is preserved.

Warning: Reset removes local credentials and breaks active integrations. Server-side user tokens may still exist until you revoke them in SonarQube.

Interactive reset

sonar system reset

You'll see a warning, then a prompt to type RESET to confirm. If you cancel or mistype the confirmation, the command exits without making changes.

Non-interactive reset

Non-interactive environments have no TTY, so the confirmation prompt is skipped unless you pass --force:

sonar system reset --force

What gets removed

The command runs four phases and prints a summary for each:

Phase
What it does

Authentication

Removes every saved connection from the keychain and best-effort revokes server-side user tokens when the CLI knows the token name.

Binaries

Uninstalls auxiliary binaries under ~/.sonar/sonarqube-cli/bin/ (for example, the secrets engine and SCA scanner) that the CLI downloaded.

Integrations

Tears down declarative installs from sonar integrate (hooks, MCP entries, patches, and related config) for all supported integrations. Deletes config files that held only Sonar-managed content; keeps files when your own or other content remains.

Filesystem

Clears CLI logs, the SCA scanner cache, temporary files under cli-tmp/ (for example, converted MCP client keystores), and globally installed Git hook scripts under ~/.sonar/sonarqube-cli/.

Reset updates state.json to match what was removed. Legacy entries in agents and agentExtensions are cleared from state; artifacts from CLI versions before the declarative integration framework are not guaranteed to be removed from disk.

What reset keeps

  • The sonar binary installed by the install script (~/.local/share/sonarqube-cli on macOS/Linux, %LOCALAPPDATA%\sonarqube-cli on Windows).

  • Your telemetry enabled/disabled preference in state.json.

Exit codes

sonar system reset exits 0 once it finishes, whether or not every phase succeeded. If a phase reports a warning (for example, a keychain entry that couldn't be deleted), the CLI prints "System reset completed with warnings" and still exits 0. Review the summary and clean up the remaining items manually.

sonar system reset doesn't require authentication. Run it when sonar auth login is broken or tokens are invalid.

Reset versus uninstall

Goal
Command / approach

Clear credentials, tools, and integrations but keep sonar on PATH

sonar system reset

Remove the CLI binary, PATH entry, and all data

Uninstalling (manual steps)

Last updated

Was this helpful?