# Updating the CLI

> **Warning:** This product is in Beta stage and we may release breaking changes. The documentation here matches the release version listed in the table of contents.

`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

```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)
* [Uninstalling](/sonarqube-cli/administration/uninstall.md)
* [Release notes](https://github.com/SonarSource/sonarqube-cli/releases)


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
