# Using the QCS CLI

The QCS CLI is a tool for interacting with QCS from the command line.

{% hint style="warning" %}
This guide refers to the new QCS CLI, made for working with pyQuil v3. If you're using pyQuil v2, refer to [Using the Legacy QCS CLI](https://docs.rigetti.com/qcs/guides/using-the-qcs-cli/using-the-legacy-qcs-cli).
{% endhint %}

## Installation

If you're using QCS via your provisioned JupyterLab IDE, `qcs` is already installed for you. Otherwise, follow the steps below to install it locally.

### macOS / Linux

Run the following in a terminal to download and install the CLI:

#### macOS

```bash
curl -s "https://qcs-cli.s3-us-west-2.amazonaws.com/latest/osx/install" | bash
```

#### Linux

```bash
curl -s "https://qcs-cli.s3-us-west-2.amazonaws.com/latest/linux/install" | bash
```

Next, add the following to the [appropriate startup script](https://kb.iu.edu/d/abdy) for your shell environment (`$HOME/.bashrc` or `$HOME/.zshrc`, for instance), to ensure the `qcs` command is available to every terminal session:

```bash
export PATH=$PATH:$HOME/.qcs/bin
```

### Windows

We don't currently have installation scripts for Windows. We recommend running the [Linux instructions above](#linux) in the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10).

## Configuring Credentials

To run many commands, the CLI will need to know your QCS credentials. To add them to the CLI, run the following:

```
qcs secrets add-credentials default default
```

Once that completes, check that the following command executes successfully (requires a QCS account and access to a web browser):

```bash
qcs api auth-get-user
```

## Staying Up-to-Date

The [`qcs version`](https://docs.rigetti.com/qcs/references/qcs-cli#version) command displays the version of your current installation:

```
qcs version
```

You can check the latest available version with the `latest` subcommand:

```bash
qcs version latest
```

To update to the latest available version, use the `update` subcommand:

```
qcs version update
```

## Making a QPU Reservation

To make a reservation against a QPU, use the [`qcs tools reserve`](https://docs.rigetti.com/qcs/access-a-qpu/reserving-time-on-a-qpu#using-the-qcs-cli) command, as described in our guide [Reserving Time on a QPU](https://docs.rigetti.com/qcs/access-a-qpu/reserving-time-on-a-qpu#using-the-qcs-cli).

## Going Further

This guide touched on only the most commonly-used commands. For details on all available QCS CLI commands and configuration options, see the [QCS CLI Reference](https://docs.rigetti.com/qcs/references/qcs-cli).


---

# 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.rigetti.com/qcs/guides/using-the-qcs-cli.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.
