Back to Cline

Installation & Setup

docs/cline-cli/installation.mdx

3.82.06.9 KB
Original Source

Cline CLI brings the full power of Cline to your terminal. In just a few minutes, you can install the CLI, authenticate with your preferred AI provider, and start running tasks from any directory on your machine.

Prerequisites

Cline CLI requires Node.js version 20 or higher. We recommend Node.js 22 for the best experience.

Check your Node.js version:

bash
node --version

If you need to install or update Node.js, visit nodejs.org or use a version manager like nvm.

Install Cline CLI

Install globally via npm:

bash
npm install -g cline

Verify the installation:

bash
cline version
<Tip> To install a specific version, use `npm install -g [email protected]`. Check [npm](https://www.npmjs.com/package/cline) for available versions. </Tip>

Authenticate

After installation, run the authentication wizard:

bash
cline auth

This launches an interactive wizard with multiple options. Choose the method that works best for your workflow.

Select "Sign in with Cline" to authenticate with your Cline account via OAuth. Your browser opens automatically to complete sign-in.

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's Codex OAuth to authenticate with your existing subscription.

Option 3: Import from Existing Tools

Already using another AI coding CLI? Cline can import your existing configuration:

  • Import from Codex CLI - Imports credentials from ~/.codex/auth.json
  • Import from OpenCode - Imports configuration from ~/.local/share/opencode/auth.json

Option 4: Bring Your Own API Key

Select "Bring your own API key" to manually configure any supported provider. Or skip the wizard entirely with flags:

bash
# 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
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

Quick Setup Flags:

FlagDescription
-p, --provider <id>Provider ID (e.g., anthropic, openai-native, openrouter, moonshot)
-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> Flags are especially useful for scripting, CI/CD environments, or setting up multiple machines. </Tip>

Supported Providers

ProviderProvider IDNotes
AnthropicanthropicDirect Claude API access
OpenAIopenai-nativeGPT-4o, GPT-4, etc.
OpenAI Codexopenai-codexChatGPT subscription OAuth
OpenRouteropenrouterAccess multiple providers
AWS BedrockbedrockClaude via AWS
Google GeminigeminiGemini Pro, etc.
X AI (Grok)xaiGrok models
CerebrascerebrasFast inference
DeepSeekdeepseekDeepSeek models
MoonshotmoonshotKimi models via Moonshot AI
OllamaollamaLocal models
LM StudiolmstudioLocal models
OpenAI CompatibleopenaiAny OpenAI-compatible API

Verify Your Setup

Confirm everything is working with a simple test:

bash
cline "What is 2 + 2?"

If Cline responds with an answer, your installation and authentication are complete.

Check your current configuration:

bash
cline config

Quick Start

Now you're ready to use Cline. Choose how you want to work:

Interactive Mode

Launch the interactive CLI for development:

bash
cline

You'll see the Cline welcome screen. Type your task and press Enter. Use:

  • Tab to toggle between Plan and Act modes
  • Shift+Tab to enable auto-approve
  • /help for available commands

Learn more about interactive mode →

Direct Task Execution

Run a task directly from your shell:

bash
cline "Add error handling to utils.js"

For non-interactive execution (perfect for scripts and CI/CD):

bash
cline -y "Run tests and fix any failures"

Learn more about headless mode →

Switching Providers

To change your configured provider at any time:

bash
cline auth

You can also use the settings panel in interactive mode:

bash
cline
# Then type: /settings
# Navigate to the API tab

Updating

Check for updates and install the latest version:

bash
cline update

Or update manually via npm:

bash
npm update -g cline

Troubleshooting

Command Not Found

If cline is not found after installation:

  1. Ensure npm global bin is in your PATH:

    bash
    npm bin -g
    
  2. Add the path to your shell configuration (.bashrc, .zshrc, etc.):

    bash
    export PATH="$PATH:$(npm bin -g)"
    
  3. Restart your terminal or source your shell config.

Permission Errors

If you get permission errors during installation:

bash
# Option 1: Use a Node version manager (recommended)
# nvm, fnm, or volta handle permissions automatically

# Option 2: Fix npm permissions
# See: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

OAuth Flow Issues

If the browser doesn't open automatically during OAuth:

  1. Copy the URL from the terminal
  2. Paste it in your browser manually
  3. Complete the sign-in flow
  4. Return to the terminal

API Key Validation

If your API key is rejected:

  1. Verify the key is correct and hasn't expired
  2. Check that you've selected the correct provider
  3. Ensure your API account has the necessary permissions

Provider-specific tips:

  • Anthropic: Keys start with sk-ant-
  • OpenAI: Keys start with sk-
  • AWS Bedrock: Requires AWS credentials configured separately. See AWS Bedrock documentation.

Uninstallation

To remove Cline CLI:

bash
npm uninstall -g cline

To also remove configuration data:

bash
rm -rf ~/.cline

Next Steps

<Columns cols={2}> <Card title="Interactive Mode" icon="terminal" href="/cline-cli/interactive-mode"> Master the interactive CLI with shortcuts and slash commands. </Card> <Card title="Headless Mode" icon="robot" href="/cline-cli/three-core-flows"> Run Cline autonomously in scripts, CI/CD pipelines, and automated workflows. </Card> <Card title="Configuration" icon="gear" href="/cline-cli/configuration"> Configure settings, rules, workflows, and environment variables. </Card> <Card title="CLI Reference" icon="book" href="/cline-cli/cli-reference"> Complete command documentation with all flags and options. </Card> </Columns>