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, cached files, and the local stats database under ~/.sonar/sonarqube-cli. Your telemetry preference and your local stats collection preference in state.json are 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 resetYou'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 --forceWhat gets removed
The command runs five phases and prints a summary for each:
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/.
Stats
Deletes the local stats database under ~/.sonar/sonarqube-cli/db/stats/.
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. The same applies to any project-level integration files the CLI has no record of, such as files inherited by cloning a repository. See Orphaned integration files.
What reset keeps
The
sonarbinary installed by the install script (~/.local/share/sonarqube-clion macOS/Linux,%LOCALAPPDATA%\sonarqube-clion Windows).Your telemetry enabled/disabled preference in
state.json.Your local stats collection preference in
state.json(stats.enabled), when you have set one.
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 could not 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 does not require authentication. Run it when sonar auth login is broken or tokens are invalid.
Reset versus uninstall
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)
Related pages
Last updated
Was this helpful?

