Updating the CLI
Keep the SonarQube CLI up to date.
Update the SonarQube CLI to the latest version, or roll it back if an update breaks something.
Homebrew
brew upgrade --cask sonarqube-cliThe next CLI command after the upgrade migrates leftover project-scoped agent integrations to global scope. You must be logged in. If you are not, run sonar auth login. The migration retries the next time you upgrade with Homebrew. See Migrate project-scoped agent integrations.
The next command also moves a SonarQube Cloud token from an older <hostname>:<YourOrganizationKey> keychain account to the hostname account. See Where tokens are stored.
sonar update does not update a Homebrew cask. The command exits with code 1 before it checks for a newer version, including when you pass --force, and prints:
CLI was installed via Homebrew and cannot be updated by `sonar update`.
→ Run `brew upgrade --cask sonarqube-cli` to update it. `sonar update` doesn't run Homebrew automatically so you stay in full control of your system updates.The CLI does not run that upgrade for you. sonar self-update prints the same message.
Standalone build (install script)
sonar update updates only the binary installed by the install script:
macOS and Linux:
~/.local/share/sonarqube-cli/bin/sonarWindows:
%LOCALAPPDATA%\sonarqube-cli\bin\sonar.exe
It re-runs that install script and replaces the binary. Your credentials and CLI state stay. The next command moves a SonarQube Cloud token from an older <hostname>:<YourOrganizationKey> keychain account to the hostname account (see Where tokens are stored). If an earlier version installed agent integrations into a repository, the upgrade migrates those to global scope (see Migrate project-scoped agent integrations).
Mise, an MDM deployment, or a binary anywhere else cannot use sonar update. The command exits with code 1 before it checks for a newer version, including when you pass --force, and prints:
This CLI installation cannot be updated by sonar update.
→ Update it through your organization, package manager, or the method used to install it.sonar self-update is a hidden compatibility alias for that same check and update. It has been deprecated since 1.4 and will be removed in a future version. Use sonar update instead. Each time you run it, the CLI prints a deprecation warning.
Check whether an update is available
The command prints the current version and the latest version, then exits without installing anything. It works from any installation and does not migrate integrations. When a newer version exists, an install-script copy is told to run sonar update. A Homebrew cask is told to run brew upgrade --cask sonarqube-cli. Any other install is told to update through your organization, package manager, or the method used to install it.
Text output is the default. For a script, pass --format json. The payload is one object with currentVersion, latestVersion, and upToDate:
sonar update --status still checks without installing. It has been deprecated since 1.9 and will be removed in a future version. Use sonar update status instead. The flag prints a deprecation warning and does not accept --format.
Automatic update notices
After certain interactive commands complete successfully, the CLI may print a short notice on stderr when a newer stable version is available:
The notice never appears on stdout and does not mix with machine-readable command output.
The CLI checks binaries.sonarsource.com for the latest stable version at most once per day. Results are cached in state.json under config.updateCheck (see State and storage).
The notice is shown only when:
The command exits with code
0You run in an interactive terminal (stdin, stdout, and stderr are TTYs)
CIis not set totrueThe command does not use machine-readable output (
--format json,--format toon, the deprecated--jsonflag, or other formatted output modes)
Eligible commands include sonar auth, sonar analyze, interactive sonar integrate, sonar list issues with --format table, sonar list projects with --format table, sonar list orgs (the default format is table), and sonar system status in text output. sonar list projects defaults to JSON: pass --format table to see the notice. sonar list orgs --format json, sonar system status --format json, and the deprecated --json flag omit the notice. Other commands (including sonar api, sonar context, hidden hook handlers, and sonar system reset) never show the notice.
On the install-script copy, the second line tells you to run sonar update. On a Homebrew cask, it tells you to run brew upgrade --cask sonarqube-cli:
On any other install, it tells you to update through your organization, package manager, or the method used to install the CLI:
Follow the line that matches your install. sonar update does not add a second copy.
Update to the latest version
On an install-script copy, run:
If the latest version is the same as what you have, the command does not re-download the binary. It still retries the agent-integration migration if any project-scoped installs remain. To re-install the latest version regardless, use --force:
Rollback
The update command does not maintain a previous-version snapshot. To go back to an earlier release, download a specific release binary from the Sonar binaries repository and replace the binary at the install path manually.
Platform notes
macOS / Linux: the update runs synchronously, streams progress to your terminal, and exits with the install script's status.
Windows: the update is spawned in a detached process so the running
sonar.execan be replaced. Your shell returns immediately; the new version is in place within a few seconds.
Rolling out updates across a fleet
For a managed rollout, do not ask every developer to run sonar update interactively. On a managed copy, that command exits with an error instead of installing a per-user binary next to the managed one. See MDM deployment. The bundled install scripts do not accept a version argument because it's not possible to pin a specific release. Instead:
Write your own install script that downloads a pinned version directly from the Sonar binaries repository and places the binary at the install path.
Distribute that script through your usual managed-tooling channel.
Bump the pinned version in the script to promote a new release across the fleet.
Migrate project-scoped agent integrations
Earlier CLI versions could integrate with Claude Code, GitHub Copilot CLI, OpenAI Codex, Cursor, and Google Antigravity at the project level. Global scope is now the default for every agent integration. After you upgrade, the CLI moves existing project-scoped integrations to global scope in your user home and removes the project files from each repository they were installed in.
The migration runs:
The first time you run a CLI command after the upgrade
When you run
sonar update, before the command checks whether this copy can update itself
On the install-script copy, that retry runs even when the CLI is already up to date. On any other install, the migration still retries, and sonar update then exits with code 1 without installing a second copy. Upgrade that CLI the way you installed it.
sonar update status only reports versions. It does not migrate integrations. The deprecated sonar update --status flag behaves the same way. Both work from any installation.
You must be logged in. If you are not, the CLI prints a warning and leaves the project-scoped installs in place. On the install-script copy:
On any other install:
If some integrations cannot migrate, the CLI still completes the rest. On the install-script copy, it prints:
On any other install, it prints:
Git hooks installed in a repository (sonar integrate git --local, or a per-repo Git install from an earlier CLI version) stay in that repository. They are not migrated. See Install for this repository only.
If Claude Code is installed, the CLI skips the global migration for Cursor and Copilot, because installing their hooks globally would conflict with Claude Code's. It still removes Cursor's and Copilot's leftover project-scoped files.
Related pages
Last updated
Was this helpful?

