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

# Installation

> System requirements, install instructions, authentication, and setup verification for Claude Code on macOS, Linux, and Windows.

## Requirements

* **Node.js** 18 or later
* **npm** 8 or later (included with Node.js)
* **Operating system**: macOS, Linux, or Windows (via WSL2)

<Tabs>
  <Tab title="macOS">
    macOS 12 (Monterey) or later is recommended. The npm installation works on both Intel and Apple Silicon.

    If you use Homebrew to manage Node.js, install it first:

    ```bash theme={null}
    brew install node
    ```

    Then install Claude Code:

    ```bash theme={null}
    npm install -g @anthropic-ai/claude-code
    ```
  </Tab>

  <Tab title="Linux">
    Most modern Linux distributions are supported. Use a version manager like [nvm](https://github.com/nvm-sh/nvm) or [mise](https://mise.jdx.dev/) to install Node.js without requiring `sudo`.

    ```bash theme={null}
    npm install -g @anthropic-ai/claude-code
    ```

    If `~/.local/bin` is not in your `PATH`, Claude Code will warn you. Add it with:

    ```bash theme={null}
    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
    ```
  </Tab>

  <Tab title="Windows (WSL2)">
    Claude Code runs on Windows through WSL2 (Windows Subsystem for Linux). Native Windows without WSL is not supported.

    1. Install WSL2: open PowerShell as Administrator and run:

    ```powershell theme={null}
    wsl --install
    ```

    2. Open your WSL terminal (Ubuntu is the default distribution).

    3. Install Node.js inside WSL using nvm:

    ```bash theme={null}
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    source ~/.bashrc
    nvm install --lts
    ```

    4. Install Claude Code:

    ```bash theme={null}
    npm install -g @anthropic-ai/claude-code
    ```

    <Note>
      Run all `claude` commands from inside your WSL terminal, not from PowerShell or Command Prompt.
    </Note>
  </Tab>
</Tabs>

## Authenticate

Run the `/login` command to sign in with your Anthropic account:

```bash theme={null}
claude /login
```

Claude Code opens a browser window and starts an OAuth 2.0 flow. You can authenticate with:

* **Claude Pro or Max subscription** — sign in via claude.ai
* **Anthropic Console (API billing)** — sign in via console.anthropic.com

After you authorize in the browser, your credentials are stored securely (macOS Keychain on macOS, or an encrypted local file on Linux and Windows/WSL). You only need to run `/login` once, or when you want to switch accounts.

### API key alternative

If you prefer to authenticate with an API key directly instead of OAuth, set the `ANTHROPIC_API_KEY` environment variable:

```bash theme={null}
export ANTHROPIC_API_KEY=sk-ant-...
```

Add this line to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.) to make it permanent. When this variable is set, Claude Code uses it instead of the stored OAuth token.

## Verify your setup

Run the `/doctor` command to check that everything is configured correctly:

```bash theme={null}
claude /doctor
```

`/doctor` shows:

* Your Claude Code version and installation type
* Whether auto-updates are enabled
* Your ripgrep status (used for fast codebase search)
* Any configuration warnings with suggested fixes

A healthy setup shows no warnings. If `/doctor` reports an issue, it also tells you how to fix it.

## Troubleshooting

<AccordionGroup>
  <Accordion title="'claude' command not found after install">
    Your npm global `bin` directory may not be in your `PATH`. Find it with:

    ```bash theme={null}
    npm config get prefix
    ```

    Then add `<prefix>/bin` to your `PATH`. For example:

    ```bash theme={null}
    echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    ```
  </Accordion>

  <Accordion title="Permission denied when installing globally">
    Avoid using `sudo npm install -g`. Instead, configure npm to use a directory you own:

    ```bash theme={null}
    mkdir -p ~/.npm-global
    npm config set prefix '~/.npm-global'
    echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    npm install -g @anthropic-ai/claude-code
    ```

    Or use a Node.js version manager like [nvm](https://github.com/nvm-sh/nvm), which avoids the permission issue entirely.
  </Accordion>

  <Accordion title="Login fails or browser does not open">
    If the browser does not open automatically, Claude Code displays the login URL in the terminal. Copy and paste it into your browser manually.

    If the OAuth flow fails with an SSL error, check whether a corporate proxy or VPN is intercepting HTTPS traffic. You may need to configure your proxy settings or use an API key instead.
  </Accordion>

  <Accordion title="Multiple Claude Code installations detected">
    If you have both an npm global install and a native install, `/doctor` will warn you. Remove the one you are not using:

    ```bash theme={null}
    # Remove the npm global install
    npm -g uninstall @anthropic-ai/claude-code
    ```

    Then re-run `claude /doctor` to confirm the warning is resolved.
  </Accordion>

  <Accordion title="ripgrep not working">
    Claude Code uses ripgrep for fast file search. If `/doctor` reports a ripgrep problem, install it with your system package manager:

    ```bash theme={null}
    # macOS
    brew install ripgrep

    # Ubuntu / Debian
    sudo apt install ripgrep

    # Arch Linux
    sudo pacman -S ripgrep
    ```

    Claude Code also ships with a built-in fallback, so most search operations still work even if the system ripgrep is unavailable.
  </Accordion>
</AccordionGroup>

<Warning>
  Do not run `sudo npm install -g @anthropic-ai/claude-code`. Installing with sudo can cause permission issues with auto-updates and is a security risk. Use a version manager or configure a user-owned npm prefix instead.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Run your first Claude Code session
  </Card>

  <Card title="How it works" icon="circle-info" href="/concepts/how-it-works">
    Understand the permission model and tool system
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.