---
title: "How to install Claude Code CLI on Mac, Windows and Linux"
description: "Install Claude Code CLI on Mac, Windows or Linux, verify the command, and start your first session with a Claude account or a pay-per-token gateway."
canonical: https://www.requesty.ai/blog/install-claude-code-cli
author: "Daniel Van den Berghe"
published: 2026-12-03
updated: 2026-12-03
tags: ["Integrations","Agents","AI Gateway"]
---

# How to install Claude Code CLI on Mac, Windows and Linux

> Install Claude Code CLI on Mac, Windows or Linux, verify the command, and start your first session with a Claude account or a pay-per-token gateway.

To install Claude Code CLI in December 2026, run `curl -fsSL https://claude.ai/install.sh | bash` on macOS or Linux, or `irm https://claude.ai/install.ps1 | iex` in Windows PowerShell. Check the installation with `claude --version`, then sign in with an eligible Claude account or use a gateway key to pay per token without a Claude subscription.

**Key takeaways**

- On Mac, Linux and WSL, the native installer is `curl -fsSL https://claude.ai/install.sh | bash`.
- On Windows PowerShell, install Claude Code with `irm https://claude.ai/install.ps1 | iex`.
- The free claude.ai plan does not include Claude Code, but a gateway provides a per-token billing option.
- Requesty connects to Claude Code through `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN`.

## Install Claude Code for your operating system

Open a terminal and run the command for your system. On Windows, paste the PowerShell command into PowerShell and the CMD command into Command Prompt.

**Mac**

```bash
curl -fsSL https://claude.ai/install.sh | bash
```

**Windows PowerShell**

```powershell
irm https://claude.ai/install.ps1 | iex
```

**Windows CMD**

```cmd
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
```

**Linux or WSL**

```bash
curl -fsSL https://claude.ai/install.sh | bash
```

The native installer needs no Node.js. Windows can run Claude Code natively or inside WSL; for WSL, open your Linux distribution's terminal and run the Linux command there. The Windows installation does not require Administrator access, according to [Anthropic's setup guide](https://code.claude.com/docs/en/setup).

Git for Windows is optional. It supplies Claude Code's Bash tool; without it, Claude Code uses PowerShell for shell commands.

> **Check which Windows terminal you opened**
>
> A PowerShell prompt starts with `PS C:\`. If you paste the PowerShell command into CMD, you may see `'irm' is not recognized`. Some PowerShell versions reject the CMD command's `&&` separators. Use the tab for your terminal.

You can also use a package manager. Anthropic lists these commands in its [setup guide](https://code.claude.com/docs/en/setup):

| System                     | Install command                       |
| -------------------------- | ------------------------------------- |
| Mac or Linux with Homebrew | `brew install --cask claude-code`     |
| Windows with WinGet        | `winget install Anthropic.ClaudeCode` |

The native installer updates Claude Code in the background. Homebrew and WinGet installations need manual updates, covered below.

## Verify the installation

Claude Code needs an internet connection, at least 4 GB of RAM, and an x64 or ARM64 processor. The supported operating systems in [Anthropic's setup guide](https://code.claude.com/docs/en/setup) include:

| System       | Supported version                                         |
| ------------ | --------------------------------------------------------- |
| macOS        | 13.0 or later                                             |
| Windows      | Windows 10 1809 or later, or Windows Server 2019 or later |
| Ubuntu       | 20.04 or later                                            |
| Debian       | 10 or later                                               |
| Alpine Linux | 3.19 or later                                             |

On Alpine, install Bash and curl before running the native installer. See [Anthropic's setup guide](https://code.claude.com/docs/en/setup) for the prerequisites.

1. **Check the version**

   Open a new terminal and run:

   ```bash
   claude --version
   ```

   A working installation prints a Claude Code version number.
2. **Fix a command not found error**

   If your terminal cannot find `claude`, check the native install location and make sure its directory is on your `PATH`. On macOS and Linux, check `~/.local/bin`; on Windows, check `%USERPROFILE%\.local\bin`. Add the applicable directory to your shell's `PATH`, then open a new terminal and try `claude --version` again.

   See [Anthropic's installation troubleshooting guide](https://code.claude.com/docs/en/troubleshoot-install) for platform-specific instructions.
3. **Run diagnostics**

   Once `claude --version` works, run:

   ```bash
   claude doctor
   ```

   This prints installation and settings diagnostics without starting a session.

## Choose how to pay for your first session

Anthropic says Claude Code requires an eligible paid Claude plan or a Console account. The free claude.ai plan does not include it. To use an eligible account, open a terminal in your project folder, run `claude`, and follow the browser login prompts in [Anthropic's setup guide](https://code.claude.com/docs/en/setup).

A gateway is another option: Claude Code sends requests to the gateway, which bills for model usage per token. With [Requesty](https://www.requesty.ai/agents/claude-code), the price is the model provider's price plus 5%, and you do not need a Claude subscription.

## Connect Claude Code to Requesty

You need a Requesty API key and two Claude Code environment variables. `ANTHROPIC_BASE_URL` selects the gateway, and `ANTHROPIC_AUTH_TOKEN` supplies the credential.

1. **Create a Requesty API key**

   Open Requesty's [Claude Code integration page](https://www.requesty.ai/agents/claude-code), follow its link to the API Keys page, and create a key. Add credits to your organization's balance before the first session: with no balance, requests return a 402 error, as listed in Requesty's [error codes](https://docs.requesty.ai/features/error-codes).
2. **Set the gateway and key**

   In the terminal where you will run Claude Code, choose the tab for your shell. The first command asks for your Requesty API key.

   **Mac, Linux or WSL**

   ```bash
   stty -echo; printf "Requesty API key: "; IFS= read -r REQUESTY_API_KEY; stty echo; printf '\n'
   unset ANTHROPIC_API_KEY
   export ANTHROPIC_BASE_URL="https://router.requesty.ai"
   export ANTHROPIC_AUTH_TOKEN="$REQUESTY_API_KEY"
   ```

   **Windows PowerShell**

   ```powershell
   $secure = Read-Host "Requesty API key" -AsSecureString
   Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
   $env:ANTHROPIC_BASE_URL = "https://router.requesty.ai"
   $env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new('', $secure).Password
   ```

   The PowerShell prompt uses secure input, as documented by [Microsoft](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/read-host?view=powershell-5.1). These shell settings last for the terminal session.

   Anthropic recommends trying shell environment variables for the first connection, as described in its [gateway connection guide](https://code.claude.com/docs/en/llm-gateway-connect). For a persistent setup, add this `env` block to `~/.claude/settings.json`, following [Requesty's Claude Code documentation](https://docs.requesty.ai/integrations/claude-code):

   ```json
   {
     "env": {
       "ANTHROPIC_BASE_URL": "https://router.requesty.ai",
       "ANTHROPIC_AUTH_TOKEN": "YOUR_REQUESTY_API_KEY",
       "ANTHROPIC_MODEL": "openai/gpt-6.1-sol"
     }
   }
   ```

   Replace `YOUR_REQUESTY_API_KEY` with your Requesty API key. Keep this in the user-level file, not in shared project settings.
3. **Start in your project folder**

   Change into the project folder you want to work on, then run:

   ```bash
   claude
   ```

   Ask Claude Code about the project to begin your first session.
4. **Verify the gateway**

   Send a message in Claude Code, then run:

   ```text
   /status
   ```

   Check that the Anthropic base URL line shows `https://router.requesty.ai` and that the auth token line shows `ANTHROPIC_AUTH_TOKEN` is in use. Anthropic describes these checks in its [gateway connection guide](https://code.claude.com/docs/en/llm-gateway-connect).

> **Leave /v1 out of this URL**
>
> For Claude Code, use `https://router.requesty.ai` without `/v1`. Claude Code adds `/v1/messages` itself. For EU data residency, pair `https://router.eu.requesty.ai` with an EU-hosted model, as described on [Requesty's Claude Code integration page](https://www.requesty.ai/agents/claude-code).

If you receive a 401 error, check that the Requesty key is in `ANTHROPIC_AUTH_TOKEN`. Anthropic sends that variable as a bearer token; `ANTHROPIC_API_KEY` uses a different header. Remove an existing `ANTHROPIC_API_KEY` from project or managed settings too. Sources: [Anthropic's gateway guide](https://code.claude.com/docs/en/llm-gateway-connect) and [Requesty's environment variable guide](https://www.requesty.ai/blog/claude-code-environment-variables-anthropic-base-url-auth-token).

You can also set `ANTHROPIC_MODEL` to choose a model. Requesty's [Claude Code integration page](https://www.requesty.ai/agents/claude-code) lists model IDs including `openai/gpt-6.1-sol` and `deepseek/deepseek-v4.1-flash-1017`. For more on credentials, see our [Claude Code API key guide](https://www.requesty.ai/blog/claude-code-api-key).

## How teams run Claude Code through Requesty

In October 2026, 21.8% of organisations running a coding agent through Requesty used Claude Code, according to our [coding agent adoption data](https://www.requesty.ai/data/coding-agent-adoption). It carried 44.58% of their coding-agent requests.

Claude Code sessions routed through Requesty had a median of 5 calls and a p95 of 43 calls in October 2026, according to our [coding agent session depth data](https://www.requesty.ai/data/coding-agent-session-depth-oct-2026). The p95 means 95% of those sessions had 43 calls or fewer.

If you are still choosing an agent, see our [comparison of Claude Code, Cursor, Codex and Aider](https://www.requesty.ai/blog/agentic-coding-tools-compared-2026-claude-code-cursor-codex-aider).

## What would 220 tasks a month cost per model?

Our [coding benchmark](https://www.requesty.ai/coding-benchmark), updated in December 2026, gives a starting point for a monthly estimate. It ran 129 private Go backend tasks through Requesty's own coding agent, with the same agent and an 80-turn budget for each model.

Take one developer who runs 10 tasks per working day for 22 working days, or 220 tasks. The last cost column multiplies the benchmark cost per task by 220.

| Model             | Benchmark cost per task | Benchmark cost per task × 220 | Tasks solved in benchmark |
| ----------------- | ----------------------: | ----------------------------: | ------------------------: |
| Claude Haiku 5.5  |                   $0.11 |                        $24.20 |                     81.4% |
| Claude Sonnet 5.5 |                   $0.52 |                       $114.40 |                     87.6% |
| Claude Opus 5.5   |                   $0.93 |                       $204.60 |                     92.2% |

These totals apply the benchmark's per-task cost, measured with Requesty's coding agent on its Go task mix, to 220 tasks.

At half that workload, or 110 tasks, the same calculation gives $12.10 for Haiku and $57.20 for Sonnet. For a closer estimate, run a sample of your own tasks and compare the cost and results. Our guide to the [cheapest way to run Claude Code](https://www.requesty.ai/blog/cheapest-way-to-run-claude-code) has more on model costs.

## Before you roll Claude Code out to a team

Native installations update in the background. For a Homebrew installation, run `brew upgrade claude-code`; for WinGet, run `winget upgrade Anthropic.ClaudeCode`. Anthropic documents these update methods in its [setup guide](https://code.claude.com/docs/en/setup).

Requesty supports caps per key, user, team and organisation, as described on its [Claude Code integration page](https://www.requesty.ai/agents/claude-code). For a team rollout, see our guide to [managing Claude Code costs across a team](https://www.requesty.ai/blog/manage-claude-code-cursor-codex-costs-across-a-team).

**Before your first project**

- Set a monthly spend cap for each developer's Requesty key.
- Keep your API key out of project settings that are committed and shared.
- Run /status in Claude Code to check the gateway address and auth token.
- Update Claude Code through your package manager if you did not use the native installer.

Set a spend cap on your key, then run a sample project through the gateway and check its cost.

## Frequently asked questions

### Is Claude Code CLI free?

The free claude.ai plan does not include Claude Code. You can use a paid Claude plan, a Console account, or a gateway key with per-token billing.

### How do I install Claude Code on Mac?

On macOS 13 or later, run curl -fsSL https://claude.ai/install.sh | bash in a terminal. Then run claude --version to check the installation.

### How do I install Claude Code on Windows?

In Windows PowerShell, run irm https://claude.ai/install.ps1 | iex. You can also install Claude Code with WinGet or run the Linux installer inside WSL.

### Do I need Node.js to install Claude Code?

The native Claude Code installer does not need Node.js.

### Can I use Claude Code without a Claude subscription?

Yes. Set ANTHROPIC_BASE_URL to https://router.requesty.ai and ANTHROPIC_AUTH_TOKEN to a Requesty API key. Requesty bills per token at the provider price plus 5%.

### How do I check whether Claude Code is using Requesty?

Run /status in Claude Code. The Anthropic base URL line should show https://router.requesty.ai, and the auth token line should show that ANTHROPIC_AUTH_TOKEN is in use.

### How do I update Claude Code?

Native Claude Code installations update in the background. Homebrew users can run brew upgrade claude-code, and WinGet users can run winget upgrade Anthropic.ClaudeCode.

## Related

- [Claude Code API key: setup without a subscription](https://www.requesty.ai/blog/claude-code-api-key)
- [Cheapest way to run Claude Code: Requesty's benchmark](https://www.requesty.ai/blog/cheapest-way-to-run-claude-code)
- [Claude Code cost management for teams: Cursor and Codex in 2026](https://www.requesty.ai/blog/manage-claude-code-cursor-codex-costs-across-a-team)
