> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-cli/administration/self-update.md).

# Updating the CLI

`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.

## Availability

`sonar self-update` is registered only on **standalone** builds — installs from the Sonar install script or a release binary from [binaries.sonarsource.com](https://binaries.sonarsource.com/). **Homebrew** and other package-manager distributions omit this command; use your package manager to upgrade instead. On those builds, `sonar self-update` is treated as an unknown command and does not appear in `sonar --help`.

## Check whether an update is available

```bash
sonar self-update --status
```

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

## Update to the latest version

```bash
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`:

```bash
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](https://binaries.sonarsource.com/) 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](https://binaries.sonarsource.com/) 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.

## Related pages <a href="#related-pages" id="related-pages"></a>

* [State and storage](/sonarqube-cli/administration/state-and-storage.md)
* [Reset the CLI](/sonarqube-cli/administration/system-reset.md)
* [Uninstalling](/sonarqube-cli/administration/uninstall.md)
* [Release notes](https://github.com/SonarSource/sonarqube-cli/releases)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-cli/administration/self-update.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
