# Quickstart guide

{% hint style="warning" %}
This product is in Beta stage and breaking changes may be released. The documentation here matches the release version listed in the table of contents.&#x20;
{% endhint %}

## Step 1: Install the SonarQube CLI

Depending on your operating system, run these commands in your terminal:

macOS and Linux:

```shell
curl -o- https://raw.githubusercontent.com/SonarSource/sonarqube-cli/refs/heads/master/user-scripts/install.sh | bash
```

Windows (from PowerShell):

```powershell
irm https://raw.githubusercontent.com/SonarSource/sonarqube-cli/refs/heads/master/user-scripts/install.ps1 | iex
```

## Step 2: Authenticate with the server

If you're connecting to SonarQube Cloud in the EU region (`https://sonarcloud.io` is the default value):

```bash
sonar auth login
```

If you're connecting to SonarQube Cloud in the [US region](/sonarqube-cloud/getting-started/getting-started-in-us-region.md), you must pass the US server URL:

```bash
sonar auth login --server https://sonarqube.us
```

If you're connecting to SonarQube Server, you must define your server URL:

```bash
sonar auth login --server <YourSonarQubeURL>
```

### Options

#### Use your own token

The code samples above include the interactive authentication, where your browser will automatically open and you'll be prompted to create a new user token. To use your own token, append `--with-token <YourSonarQubeUserToken>` to your command. Both the URL and a user token are required for authentication.

{% hint style="warning" %}
*User tokens* are required when authenticating your SonarQube CLI with SonarQube Cloud or SonarQube Server. Note that the CLI will not function properly if *project tokens*, *global tokens*, or *scoped organization tokens* are used during the setup process.
{% endhint %}

#### Define your organization

SonarQube Cloud authentication requires an organization. If you don't specify one, the CLI will try to choose one automatically. Add `-o <YourSonarQubeCloudOrganization>` as an option to define a specific organization. Your SonarQube Cloud **Organization Key** can be found by going to your SonarQube Cloud **Account** > **Organizations** page: [`https://sonarcloud.io/account/organizations`](https://sonarcloud.io/account/organizations).

This option will be ignored when authenticating with SonarQube Server.

#### Verify your connection

```bash
sonar auth status
```

## Step 3: Review the SonarQube CLI commands

For a full list of available commands, see the [Commands](/sonarqube-cli/using/commands.md) page.


---

# 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/quickstart-guide.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.
