Back to guides
Installation·September 11, 2026·Updated October 3, 2026·9 min read

Install Claude Code: The Command for Windows, macOS, and Linux — and How to Use It Without a Subscription

Installation is a single command. What causes trouble is Windows — which terminal, PATH — and the next step: how to use it without a subscription.

Installing Claude Code takes just one command: on macOS, Linux, or WSL, run curl -fsSL https://claude.ai/install.sh | bash; on Windows, run irm https://claude.ai/install.ps1 | iex in PowerShell (in Command Prompt, or CMD, use the line from install.cmd below). Then open a new terminal, check with claude --version, and run claude to get started. On your first connection, there are two options: sign in with a Pro, Max, Team, Enterprise, or Console account (the free Claude.ai plan does not include Claude Code), or set the two environment variables ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN and use a pay-as-you-go API key — with no subscription.

Commands verified on September 11, 2026 in the official Anthropic installation documentation.

Before you install

RequirementRequirements
Operating systemmacOS 13.0+, Windows 10 1809+ or Windows Server 2019+, Ubuntu 20.04+, Debian 10+, Alpine Linux 3.19+
Hardware4 GB of RAM or more, x64 or ARM64 processor
ShellBash, Zsh, PowerShell, or CMD
NetworkInternet connection in a country supported by Anthropic (Brazil is supported)
AccountPro, Max, Team, Enterprise, or Console — or an API key (see below)

Install on macOS and Linux

Open Terminal and paste:

Terminal
# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash

This is the recommended method: it installs a standalone binary that updates itself in the background. The shortcut is in ~/.local/bin/claude, and a terminal that was already open will not see the updated PATH — so open another window before testing. The command is the same in WSL.

Install on Windows

On Windows, there are two different command lines, and the only difference is which terminal you are using. If the prompt starts with PS C:\Users\SeuNome>, you are in PowerShell; if it has only C:\Users\SeuNome> and no PS, you are in Command Prompt (CMD). You do not need to run as administrator.

PowerShell
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
cmd.exe
:: Windows Prompt de Comando (CMD)
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Pasting a command into the wrong terminal is the most common failure. The CMD line in PowerShell returns The token '&&' is not a valid statement separator; the PowerShell line in CMD returns 'irm' is not recognized as an internal or external command (on Windows in Portuguese, “is not recognized as an internal or external command”). And pasting the macOS curl … | bash into PowerShell returns A parameter cannot be found that matches parameter name 'fsSL'. In all three cases, just use the correct line.

Installing Git for Windows is optional but recommended: Claude Code uses the Git Bash bundled with it to run commands; without it, it uses PowerShell. If Git is installed but Git Bash still cannot be found, set CLAUDE_CODE_GIT_BASH_PATH in the env block of the settings to point to bash.exe.

OptionRequiresSandboxWhen to choose it
Native WindowsNothing; Git for Windows is optionalUnsupportedNative Windows projects and tools
WSL 2WSL 2 enabledSupportedLinux tools or commands running in a sandbox
WSL 1WSL 1 enabledUnsupportedWhen WSL 2 is unavailable

In WSL, run the macOS/Linux command inside the WSL terminal and open claude there — not from PowerShell or CMD.

Using a package manager

It works, with one important difference: none of these update themselves by default. You update them manually (brew upgrade claude-code, winget upgrade Anthropic.ClaudeCode). There are also signed apt, dnf, and apk repositories for Debian/Ubuntu, Fedora/RHEL, and Alpine.

# Homebrew (macOS, Linux) — canal stable
brew install --cask claude-code

# WinGet (Windows)
winget install Anthropic.ClaudeCode

# npm — exige Node.js 22 ou mais novo; nunca com sudo
npm install -g @anthropic-ai/claude-code

With npm, starting with version 2.1.198, the package requires Node.js 22 or later; on an older Node version, npm only displays a EBADENGINE warning and the installation completes. The package installs the same native binary, which does not use Node.js to run. Never use sudo npm install -g: it causes permission issues and is a security risk.

Verify the installation

claude --version   # imprime a versão, por exemplo 2.1.211 (Claude Code)
claude doctor      # diagnóstico da instalação e das configurações, sem abrir sessão

Keep claude doctor handy: without opening a session, it shows the installation health, errors in configuration files, and the suggested fix — the fastest way to tell whether the problem is with the installation or the configuration.

If you see command not found: claude (or, on Windows, that claude is not recognized), the installation folder is not in PATH. On macOS and Linux, open a new terminal; if that does not fix it, add ~/.local/bin to PATH in ~/.zshrc or ~/.bashrc. On Windows, the folder is %USERPROFILE%\.local\bin; check and add it through PowerShell:

PowerShell
# 1. Veja se a pasta de instalação já está no PATH
$env:PATH -split ';' | Select-String '\.local\\bin'

# 2. Sem saída? Adicione ao PATH do usuário e abra um terminal novo
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')

# 3. No terminal novo: se houver duas instalações, aparecem dois caminhos
where.exe claude

First connection: subscription or API key

Option A — sign in with a subscription

In your project folder, run claude and follow the browser sign-in flow with a Pro, Max, Team, Enterprise, or Console account. One detail that often causes confusion: if the ANTHROPIC_API_KEY variable is already set, Claude Code asks once whether to use that key. If you decline, it silently ignores the key from then on, without asking again — making it seem as though the variable is not being read. To reactivate it, go to /config → Use custom API key.

Option B — no subscription, pay-as-you-go API key

Claude Code natively reads ANTHROPIC_BASE_URL, so pointing it to any Anthropic Messages API endpoint is a supported configuration — no plugin, proxy, or modified binary required. The steps: create an account, top up your balance (minimum $10), generate a sk-kn- key in the key dashboard (it is shown only once), and set the variables. On macOS and Linux:

~/.zshrc
export ANTHROPIC_BASE_URL=https://api.kunavo.com   # só o domínio, sem /v1
export ANTHROPIC_AUTH_TOKEN=sk-kn-...
export ANTHROPIC_MODEL=claude-sonnet-5
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5

On Windows, to test in a PowerShell window:

PowerShell
# Vale só para esta janela do PowerShell
$env:ANTHROPIC_BASE_URL = "https://api.kunavo.com"
$env:ANTHROPIC_AUTH_TOKEN = "sk-kn-..."
$env:ANTHROPIC_MODEL = "claude-sonnet-5"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "claude-opus-5-5"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "claude-sonnet-5"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5"
claude

For a permanent setup, the best place is the env block in the user settings file, ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json). There, the variables apply to any terminal, the editor extension, and background processes. If the file already contains other settings, just add the env block:

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.kunavo.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-kn-...",
    "ANTHROPIC_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5"
  }
}

There is a catch with each of these lines:

  • ANTHROPIC_BASE_URL should contain only the domain. Claude Code appends /v1/messages; with /v1 at the end, the request goes to /v1/v1/messages and returns 404.
  • Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. They go in different HTTP headers: the first sends Authorization: Bearer and takes effect immediately; the second sends x-api-key and still requires the one-time approval described above.
  • Enter the exact model name in ANTHROPIC_MODEL. Kunavo only recognizes an exact name match and does not translate old names with a date suffix.
  • Also pin ANTHROPIC_DEFAULT_OPUS_MODEL and ANTHROPIC_DEFAULT_SONNET_MODEL. Claude Code's default model and the opus alias point to the latest Opus and, if Kunavo does not offer it yet, the first request returns a 404. The sonnet alias already requests Sonnet 5.5, which Kunavo does not offer: without pinning it, /model sonnet, the execution phase of opusplan, and subagents using model: sonnet receive a 404. The opus alias is pinned to Opus 5.5 (claude-opus-5-5), which requires Claude Code v2.1.280 or later—in an older installation, run claude update.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL covers background calls that Claude Code makes automatically (summaries, titles). Pointing it to Haiku saves money effortlessly.

Never put the key in the project’s .claude/settings.json — that file goes into git and is available to anyone who clones the repository. In the VS Code extension, put the variables in claudeCode.environmentVariables, in VS Code’s own user settings, because the extension checks the credentials before starting.

Rates per 1M tokens, taken from the catalog:

ModelKunavo (in / out)Anthropic list (in / out)DifferenceUse case
claude-haiku-4-5$0,70 / $3,50$1,00 / $5,00~30% lowerSimple tasks and Claude Code's own background calls
claude-sonnet-5$1,40 / $7,00$2,00 / $10,00~30% lowerThe everyday default model
claude-opus-5-5$2,80 / $14,00$4,00 / $20,00~30% lowerLarge refactorings and planning (the opus alias)
claude-fable-5$7,00 / $35,00$10,00 / $50,00~30% lowerThe hardest problems

To switch models during a session, use /model with the full name (for example, /model claude-opus-5-5) or launch Claude Code with claude --model claude-opus-5-5. The monthly cost of usage and when a subscription makes more sense are covered in the Claude Code pricing guide.

How to check which option is active

In Claude Code, run /status. A Auth token line means the key is active; a Login method line with a claude.ai account means the variable was not read. The two do not stack: with the variable set, the subscription is inactive; remove the variable and it switches back to the subscription without reinstalling.

Behind a gateway, three things change: Remote Control and voice dictation do not work (they require claude.ai identity); /fast may say that fast mode is unavailable because that check goes directly to Anthropic, but normal requests are unaffected; and the figures in /context become local estimates. Code, tools, subagents, MCP, hooks, and prompt caching work the same way. Details are in the integration documentation (in English).

Paying from Brazil — Pix at checkout

The claude.ai subscription is a recurring charge in dollars that requires an international card enabled for overseas purchases. With the API key option, the top-up goes through Stripe Checkout, and Pix appears as a payment method for those paying from Brazil: the price is in USD and Stripe displays the converted amount in reais before you confirm. An international card (Visa, Mastercard, American Express), Apple Pay, Google Pay, and Link also appear at checkout. The wallet is prepaid—minimum top-up of $10, balance that does not expire, and failed requests are not charged—and each key can have a monthly spending limit. The step-by-step instructions, screen by screen, are at how to pay for the API with Pix.

Common errors

What you seeCause and solution
'bash' is not recognized as the name of a cmdletYou ran the macOS/Linux command on Windows. Use the PowerShell line.
The command prints the script text and installs nothingYou left out the second half. In PowerShell, use the full line irm … | iex; in CMD, use the complete command with -o install.cmd.
syntax error near unexpected token '<', a 403, or another curl errorThe download did not retrieve the script — usually because of a proxy or network filter along the way. Try another network or install through the package manager.
Claude Code does not support 32-bit WindowsYou opened PowerShell (x86). Open the regular “Windows PowerShell.”
running scripts is disabled on this system after npmPowerShell's execution policy blocks npm's .ps1 scripts. Use the native installer or run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser.
401 after setting up the keyThe key is in the wrong variable and is sent in a header the server does not read. Check that it is ANTHROPIC_AUTH_TOKEN.
404 after setting up the keyANTHROPIC_BASE_URL with /v1 at the end, a model name different from the exact one in ANTHROPIC_MODEL, or /model sonnet without ANTHROPIC_DEFAULT_SONNET_MODEL.

After installing

On first use, run /init inside the project: Claude Code reads the repository and creates a CLAUDE.md containing the test commands and conventions it finds. Review this file and keep it short — it is loaded in every session. Between unrelated tasks, /clear starts a new conversation; for a long-running task, /compact summarizes the history and continues.

To be candid about the choice: for people who use Claude Code for many hours a day, the subscription usually costs less; pay-as-you-go makes sense when usage fluctuates or when you do not want to be tied to the 5-hour window — and a month with no usage costs zero. With Kunavo, you use shared capacity, with no dedicated quota or contractual SLA; if you need those guarantees, subscribe directly with Anthropic.

Frequently asked questions

How do I install Claude Code?

On macOS, Linux, or WSL, run curl -fsSL https://claude.ai/install.sh | bash. On Windows, run irm https://claude.ai/install.ps1 | iex in PowerShell, or run curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd in Command Prompt (CMD). This is Anthropic's recommended native installer, and it updates itself in the background. Then open a new terminal and verify the installation with claude --version.

How do I install Claude Code on Windows? Do I need WSL?

No. Run the installer from PowerShell or CMD without administrator privileges, then open claude in any terminal. Git for Windows is optional but recommended: Claude Code uses its Git Bash to run commands, and uses PowerShell if Git for Windows is absent. WSL 2 is the choice if you need Linux tools or sandboxed execution; in that case, install and run claude inside the WSL terminal.

Do I need Node.js to install Claude Code?

No, unless you install it through npm. The native installer, Homebrew, WinGet, and Linux repositories install a native binary that does not use Node.js. With npm, starting with version 2.1.198, the package requires Node.js 22 or later, and you should never use sudo npm install -g.

Can I use Claude Code without a Pro or Max subscription?

Yes. Signing in requires a Pro, Max, Team, Enterprise, or Console account, and the free Claude.ai plan does not include Claude Code. The alternative is a pay-as-you-go API key: with the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN variables set, Claude Code authenticates with that endpoint, with no subscription or monthly fee, and you pay only for the tokens used.

I installed it, but the terminal says claude is not recognized. What should I do?

The installation folder is not in your PATH. First, close the terminal and open a new one. On macOS and Linux, the folder is ~/.local/bin; on Windows, it is %USERPROFILE%\.local\bin, which you can add to the user PATH through PowerShell. Then run claude doctor to check the installation status and, if you have an older npm installation, keep only one installation.

Can I pay with Pix?

Yes, on the API key route. Kunavo balance top-ups go through Stripe Checkout, and Pix is available to customers paying from Brazil: the price is set in dollars, and Stripe shows the converted amount in reais before you confirm. The minimum top-up is $10, and the balance does not expire. The claude.ai subscription, on the other hand, is a recurring charge in dollars on an international card.

Should ANTHROPIC_BASE_URL end with /v1?

No. Claude Code appends /v1/messages automatically, so the variable should contain only the domain, such as https://api.kunavo.com. A value ending in /v1 sends requests to /v1/v1/messages and returns 404 — this is the most common configuration error.