> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/cline/cline/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Cline CLI via npm or Homebrew, then authenticate with your AI provider.

This guide walks through installing Cline CLI, verifying the installation, and authenticating with an AI provider.

## Prerequisites

Cline CLI requires **Node.js 20 or higher**. Node.js 22 is recommended.

Check your current version:

```bash theme={null}
node --version
```

If you need to install or upgrade Node.js, download it from [nodejs.org](https://nodejs.org) or use a version manager like [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm).

## Install Cline CLI

<Tabs>
  <Tab title="npm (recommended)">
    Install globally via npm:

    ```bash theme={null}
    npm install -g cline
    ```

    To install a specific version:

    ```bash theme={null}
    npm install -g cline@2.0.0
    ```
  </Tab>

  <Tab title="From source">
    Clone the repository and build from source:

    ```bash theme={null}
    git clone https://github.com/cline/cline.git
    cd cline/cli
    npm install
    npm run build
    npm link
    ```
  </Tab>
</Tabs>

### Verify the installation

```bash theme={null}
cline version
```

Expected output:

```
Cline CLI version: 2.11.0
```

## Authenticate

Run the authentication wizard to configure your AI provider:

```bash theme={null}
cline auth
```

The wizard presents several options. Choose the one that matches your setup.

### Option 1: Sign in with Cline (recommended)

Select **Sign in with Cline** to authenticate via OAuth using your Cline account. Your browser opens automatically to complete the sign-in flow.

### Option 2: Sign in with ChatGPT subscription

If you have a ChatGPT Plus or Pro subscription, select **Sign in with ChatGPT Subscription**. This uses OpenAI Codex OAuth to authenticate with your existing subscription — no separate API key needed.

### Option 3: Import from an existing tool

Cline can import credentials from other AI CLI tools:

* **Import from Codex CLI** — reads from `~/.codex/auth.json`
* **Import from OpenCode** — reads from `~/.local/share/opencode/auth.json`

### Option 4: Bring your own API key

Select **Bring your own API key** to configure any supported provider manually. You can also skip the wizard entirely and pass flags directly:

```bash theme={null}
# Anthropic (Claude)
cline auth -p anthropic -k sk-ant-api-xxxxx -m claude-sonnet-4-5-20250929

# OpenAI
cline auth -p openai-native -k sk-xxxxx -m gpt-4o

# OpenRouter
cline auth -p openrouter -k sk-or-xxxxx -m anthropic/claude-sonnet-4-5-20250929

# Moonshot (Kimi)
cline auth -p moonshot -k sk-xxxxx -m kimi-k2.5

# OpenAI-compatible provider with custom base URL
cline auth -p openai -k your-api-key -b https://api.example.com/v1
```

**Auth flags:**

| Flag                  | Description                                                    |
| --------------------- | -------------------------------------------------------------- |
| `-p, --provider <id>` | Provider ID (e.g., `anthropic`, `openai-native`, `openrouter`) |
| `-k, --apikey <key>`  | Your API key                                                   |
| `-m, --modelid <id>`  | Model ID (e.g., `claude-sonnet-4-5-20250929`, `gpt-4o`)        |
| `-b, --baseurl <url>` | Base URL for OpenAI-compatible providers                       |

<Tip>
  The flag-based setup is ideal for CI/CD environments, automated machine provisioning, or configuring multiple machines with the same provider.
</Tip>

### Supported providers

| Provider          | Provider ID     | Notes                                     |
| ----------------- | --------------- | ----------------------------------------- |
| Anthropic         | `anthropic`     | Direct Claude API access                  |
| OpenAI            | `openai-native` | GPT-4o, GPT-4, and others                 |
| OpenAI Codex      | `openai-codex`  | ChatGPT subscription via OAuth            |
| OpenRouter        | `openrouter`    | Access multiple providers through one key |
| AWS Bedrock       | `bedrock`       | Claude via AWS; requires AWS credentials  |
| Google Gemini     | `gemini`        | Gemini Pro and others                     |
| X AI (Grok)       | `xai`           | Grok models                               |
| Cerebras          | `cerebras`      | Fast inference                            |
| DeepSeek          | `deepseek`      | DeepSeek models                           |
| Moonshot          | `moonshot`      | Kimi models                               |
| Ollama            | `ollama`        | Local models                              |
| LM Studio         | `lmstudio`      | Local models                              |
| OpenAI-compatible | `openai`        | Any OpenAI-compatible API                 |

## Verify your setup

Confirm everything is working end-to-end:

```bash theme={null}
cline "What is 2 + 2?"
```

If Cline responds, your installation and authentication are complete. To inspect your current configuration:

```bash theme={null}
cline config
```

## Quick start

Choose how you want to work:

**Interactive mode** — open the TUI for hands-on development:

```bash theme={null}
cline
```

Type your task and press Enter. Use `Tab` to toggle Plan/Act mode, `Shift+Tab` to enable auto-approve, and `/help` to see available slash commands.

**Headless mode** — run a task autonomously:

```bash theme={null}
cline -y "Add error handling to utils.js"
```

## Updating

Update to the latest version:

```bash theme={null}
cline update
```

Or update via npm directly:

```bash theme={null}
npm update -g cline
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="'cline' command not found after installation">
    The npm global binary directory may not be in your `PATH`.

    1. Find the global bin path:
       ```bash theme={null}
       npm bin -g
       ```
    2. Add it to your shell configuration (`.bashrc`, `.zshrc`, etc.):
       ```bash theme={null}
       export PATH="$PATH:$(npm bin -g)"
       ```
    3. Reload your shell:
       ```bash theme={null}
       source ~/.zshrc  # or ~/.bashrc
       ```

    Using a version manager like nvm, fnm, or Volta avoids this issue entirely — they manage PATH automatically.
  </Accordion>

  <Accordion title="Permission errors during installation">
    If you see `EACCES` errors when running `npm install -g cline`, the recommended fix is to use a Node.js version manager (nvm, fnm, or Volta). These install Node into your home directory, eliminating permission problems.

    Alternatively, follow the [npm guide on fixing permission errors](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally).
  </Accordion>

  <Accordion title="Browser doesn't open during OAuth">
    1. Copy the URL printed in the terminal.
    2. Paste it into your browser manually.
    3. Complete the sign-in flow.
    4. Return to the terminal — it will detect the completed auth automatically.
  </Accordion>

  <Accordion title="API key rejected">
    1. Verify the key is correct and hasn't been revoked.
    2. Confirm you selected the right provider ID.
    3. Check that your API account has the required permissions or credits.

    Provider-specific notes:

    * **Anthropic**: keys start with `sk-ant-`
    * **OpenAI**: keys start with `sk-`
    * **AWS Bedrock**: requires AWS credentials configured separately — see [AWS Bedrock setup](/models/cloud-providers)
  </Accordion>
</AccordionGroup>

## Uninstalling

Remove the CLI binary:

```bash theme={null}
npm uninstall -g cline
```

To also remove configuration and task history:

```bash theme={null}
rm -rf ~/.cline
```

## Next steps

<CardGroup cols={2}>
  <Card title="Interactive mode" icon="terminal" href="/cline-cli/interactive-mode">
    Learn keyboard shortcuts, slash commands, and file mentions.
  </Card>

  <Card title="Headless mode" icon="robot" href="/cline-cli/headless-mode">
    Run Cline autonomously in scripts and CI/CD pipelines.
  </Card>

  <Card title="CLI reference" icon="book" href="/cline-cli/cli-reference">
    Complete documentation for all commands and flags.
  </Card>
</CardGroup>
