BetaDeveloper

Updating the CLI

Keep the SonarQube CLI up to date with the built-in self-update command.

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

sonar self-update upgrades the CLI in place. Under the hood it re-runs the same install script that put sonar on your system, replacing the binary while leaving your state, credentials, and integrations untouched.

Check whether an update is available

sonar self-update --status

The command prints the current version, the latest version, and exits without changing anything.

Update to the latest version

sonar self-update

If the latest version is the same as what you have, the command exits without doing anything. To re-install the latest version regardless, use --force:

sonar self-update --force

Rollback

The self-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.exe can 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 self-update interactively. The bundled install and self-update scripts do not accept a version argument, so they cannot 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.

Last updated

Was this helpful?