GrabAICredits (GrabAICredits)Submit a deal

How to Install Claude Code in 2026 (macOS, Windows, Linux, npm)

Verified ·11 min read

To install Claude Code, run Anthropic's native installer in a terminal (one command for macOS, Linux and WSL, one for Windows PowerShell and one for Windows CMD; all three are below), then start Claude Code in your project folder and sign in in the browser. You need a Claude Pro, Max, Team or Enterprise plan, a Claude Console (API) account, or access through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry, because the free Claude plan doesn't include Claude Code. Node.js is only required if you choose the npm method.

This guide covers every official install method, how to check the install, the first login, Windows and Alpine specifics, and fixes for the errors Anthropic's troubleshooting page lists most often. All commands were checked against Anthropic's Claude Code docs on October 17, 2026.

Before you install: account and system requirements

Which account you need

AccountHow Claude Code is paid forWhere to compare
Claude Pro or MaxIncluded; usage counts toward your plan's limitsClaude pricing
Claude Team or EnterpriseIncluded for members your admin invitedClaude Code pricing
Claude ConsolePay as you go at API rates from prepaid creditsClaude API pricing
Amazon Bedrock, Google Cloud's Agent Platform, Microsoft FoundryBilled by your cloud providerYour cloud provider's pricing

If you're not sure whether a free plan is enough, our guide Is Claude free? explains what the free tier covers. Students and open-source maintainers should check the Claude student offers and Claude for Open Source pages before paying.

System requirements

  • Operating system: macOS 13.0+, Windows 10 1809+ or Windows Server 2019+, Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+
  • Hardware: 4 GB+ RAM, x64 or ARM64 processor (32-bit Windows is not supported)
  • Shell: Bash, Zsh, PowerShell or CMD
  • Network and location: an internet connection, in a country Anthropic supports
  • ripgrep: usually included with Claude Code; Alpine needs it installed separately (see below)

Step 1: Choose an install method

MethodPlatformsAuto-updates?Needs Node.js?
Native installer (recommended)macOS, Linux, WSL, WindowsYes, in the backgroundNo
HomebrewmacOS, LinuxNo by default; upgrade with brewNo
WinGetWindowsNo by default; upgrade with wingetNo
apt, dnf, apkDebian/Ubuntu, Fedora/RHEL, AlpineNo; updates come with system upgradesNo
npmmacOS, Linux, WindowsYes, if the npm global directory is writableYes, Node.js 22 or later

Most people should use the native installer. It is the method Anthropic recommends, it keeps itself up to date, and it doesn't need any other software. Package managers make sense if your team already manages tools that way or if you want updates on your own schedule.

Step 2: Run the native installer

Open a terminal and run the one command for your system.

macOS, Linux and WSL

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

Windows PowerShell

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

Windows CMD

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

On Windows, the prompt shows PS C:\ in PowerShell and C:\ without PS in CMD. If you see "The token '&&' is not a valid statement separator", you are in PowerShell, so use the PowerShell command. If you see "'irm' is not recognized", you are in CMD.

The installer shows no progress while it downloads, so wait for it to finish. On macOS and Linux it places the claude launcher at ~/.local/bin/claude and keeps versions under ~/.local/share/claude/versions/. On Windows the program goes to %USERPROFILE%\.local\bin\claude.exe. You don't need administrator rights.

Install the stable channel instead

By default you get the latest channel, which ships new releases immediately. The stable channel serves a version that is typically about a week old and skips releases with major regressions. The channel you choose at install time becomes your default for auto-updates. macOS, Linux and WSL:

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

Windows PowerShell:

& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable

Windows CMD:

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

You can also pass a specific version number in place of stable. Our update guide covers version pinning, switching channels later and rolling back.

Other official install methods

Homebrew (macOS and Linux)

brew install --cask claude-code

The claude-code cask follows the stable channel. To get new releases as soon as they ship, install the latest cask instead:

brew install --cask claude-code@latest

WinGet (Windows)

winget install Anthropic.ClaudeCode

apt (Debian and Ubuntu)

Anthropic publishes signed apt, dnf and apk repositories. These commands set up the stable channel. First, if curl or gpg is missing on a fresh system:

sudo apt install curl gnupg

Download the signing key:

sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://downloads.claude.ai/keys/claude-code.asc \
  -o /etc/apt/keyrings/claude-code.asc

Check the key before trusting it. The fingerprint should be 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE:

gpg --show-keys /etc/apt/keyrings/claude-code.asc

Register the repository and install:

echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main" \
  | sudo tee /etc/apt/sources.list.d/claude-code.list
sudo apt update
sudo apt install claude-code

dnf (Fedora and RHEL)

sudo tee /etc/yum.repos.d/claude-code.repo <<'EOF'
[claude-code]
name=Claude Code
baseurl=https://downloads.claude.ai/claude-code/rpm/stable
enabled=1
gpgcheck=1
gpgkey=https://downloads.claude.ai/keys/claude-code.asc
EOF
sudo dnf install claude-code

dnf asks you to confirm the key fingerprint on first install. It should match 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE.

apk (Alpine Linux)

wget -O /etc/apk/keys/claude-code.rsa.pub \
  https://downloads.claude.ai/keys/claude-code.rsa.pub
echo "https://downloads.claude.ai/claude-code/apk/stable" >> /etc/apk/repositories
apk add claude-code

npm

The npm package requires Node.js 22 or later. On an older Node.js, npm prints an EBADENGINE warning but the install still completes:

npm install -g @anthropic-ai/claude-code

The npm package installs the same native binary as the standalone installer, pulled in through a per-platform optional dependency, and the installed claude command doesn't use Node at runtime. Supported npm platforms are darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, win32-x64 and win32-arm64, and your package manager must allow optional dependencies.

Don't use sudo with a global npm install. Anthropic warns that it can cause permission issues and security risks. If you get permission errors, switch to the native installer or follow the official troubleshooting page.

Step 3: Verify the installation

Open a new terminal window (the old one keeps its old PATH) and run:

claude --version

A working install prints a version number followed by (Claude Code). If your shell says claude isn't found, the install directory isn't on your PATH yet; the troubleshooting section below has the fix. For a fuller read-only health check without starting a session, which also reports settings-file errors and warnings with suggested fixes, run:

claude doctor

Step 4: Start Claude Code and log in

Go to your project folder and start a session:

cd /path/to/your/project
claude

On first launch, Claude Code opens a browser window to log in. If the browser doesn't open, press c to copy the login URL and paste it into a browser. When login finishes, the terminal shows Login successful and asks you to press Enter. These accounts work:

  • Claude Pro, Max, Team or Enterprise: log in with your claude.ai account. Usage counts toward your plan's limits.
  • Claude Console: pay-as-you-go API billing. If you're joining someone else's Console organization, an admin must invite you first. On first login, Claude Code creates a "Claude Code" workspace in the Console for cost tracking.
  • Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry: set the provider's environment variables, or choose 3rd-party platform at the login prompt. No browser login is needed.

If ANTHROPIC_API_KEY is set and you approve it when asked, Claude Code skips the browser login and bills your API credits; our Anthropic API key guide explains how to create and fund one. To switch accounts later, type this inside a session:

/login

Logging in over SSH, in WSL2 or in a container

Here the browser usually opens on a different machine and can't redirect back to Claude Code. After you sign in, the browser shows a login code instead; paste it at the Paste code here if prompted prompt. If pasting into the prompt doesn't work, sign in with this command, which reads the pasted code from standard input:

claude auth login

If the browser doesn't open at all from WSL2, point the BROWSER variable at your Windows browser, for example:

export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
claude

Try a first task

Anthropic's quickstart suggests starting with plain-language questions about your code. Type prompts like these at the Claude Code prompt:

what does this project do?
where is the main entry point?
add a hello world function to the main file

Claude Code reads files as needed and asks before making changes, depending on the session's permission mode (press Shift+Tab to switch modes). For larger changes, see our guide to Claude Code plan mode.

Installing Claude Code on Windows

You can run Claude Code natively on Windows or inside WSL:

OptionRequiresSandboxingBest for
Native WindowsNothing; Git for Windows is optionalNot supportedWindows-native projects and tools
WSL 2WSL 2 enabledSupportedLinux toolchains or sandboxed commands
WSL 1WSL 1 enabledNot supportedWhen WSL 2 isn't available
  • You don't need to run the installer as Administrator.
  • Without Git for Windows, Claude Code runs shell commands through its PowerShell tool. With it installed, Claude Code can also use Git Bash for its Bash tool.
  • For WSL, open your WSL distribution and run the Linux installer there. Install and launch claude inside WSL, not from PowerShell or CMD.
  • If an older Claude Desktop install makes the claude command open the Desktop app instead of the CLI, update Claude Desktop to the latest version.

If Claude Code can't find Git Bash, set its path in your settings.json file:

{
  "env": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
  }
}

Installing on Alpine and other musl-based Linux

The install command needs bash and curl, and Claude Code needs libgcc, libstdc++ and ripgrep at runtime. Alpine doesn't include bash or curl by default, so install the packages first:

apk add bash curl libgcc libstdc++ ripgrep

ripgrep is in Alpine's community repository; add it to /etc/apk/repositories if apk can't find the package. Then tell Claude Code to use the system ripgrep in settings.json:

{
  "env": {
    "USE_BUILTIN_RIPGREP": "0"
  }
}

Troubleshooting installation

These are the problems Anthropic's installation troubleshooting page covers most often, with the official fixes.

"command not found: claude" or "'claude' is not recognized"

The install worked but its folder isn't on your PATH. First open a new terminal. If it still fails on macOS or Linux, check the file exists:

ls -la ~/.local/bin/claude

If it does, add the folder to your PATH. For Zsh, the macOS default:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

For Bash on Linux:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

For Bash on macOS, use ~/.bash_profile instead of ~/.bashrc, because Terminal starts Bash as a login shell. On Windows PowerShell, add the install folder to your user PATH, then restart the terminal:

$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')

A terminal inside an editor such as VS Code takes its PATH from the editor, so quit and reopen the editor too. Note that the VS Code extension bundles its own private copy of Claude Code and doesn't put claude on your PATH; run the standalone installer if you want the command in a terminal.

"syntax error near unexpected token '<'" or a 403 from the installer

The install URL returned a web page or an error instead of the script. If the output mentions App unavailable in region, Claude Code isn't available in your country. Otherwise it is often a temporary problem, a proxy or firewall, or regional routing. Retry after a few minutes, check that you can reach the download server, or use Homebrew or WinGet instead. To test connectivity on macOS or Linux:

curl -sI https://downloads.claude.ai/claude-code-releases/latest

A first line with a 200 status means you reached the server. Behind a corporate proxy, set HTTP_PROXY and HTTPS_PROXY to your proxy's address before running the installer.

"Killed" during install on a small Linux server

The out-of-memory killer stopped the install. Anthropic says installing needs roughly 512 MB of free memory, and Claude Code requires at least 4 GB of RAM to run. Close other processes, use a larger instance, or add swap space and retry:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Install hangs in Docker

Running the installer as root from / makes it scan the whole filesystem. Set a working directory first:

WORKDIR /tmp
RUN curl -fsSL https://claude.ai/install.sh | bash

TLS or SSL errors

Errors such as curl: (35) TLS connect error or PowerShell's Could not create SSL/TLS secure channel mean the secure connection failed. On Ubuntu or Debian, update your CA certificates:

sudo apt-get update && sudo apt-get install ca-certificates

In Windows PowerShell 5.1, enable TLS 1.2 in the same window before running the installer:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Behind a corporate proxy that inspects TLS, ask IT for the proxy's CA certificate and point NODE_EXTRA_CA_CERTS at it once Claude Code is installed.

Homebrew says the cask is unavailable

Your local Homebrew index is older than the cask. Refresh it and retry:

brew update
brew install --cask claude-code

npm: "claude native binary not installed" or scripts disabled

The npm package delivers the real binary as an optional dependency and links it with a postinstall step. If you installed with --omit=optional or --ignore-scripts (or a pnpm setup that skips them), reinstall without those options. On Windows, "running scripts is disabled on this system" comes from PowerShell's execution policy blocking npm's .ps1 shims; allow locally created scripts for your user, or use the native installer instead:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

An old version keeps running after you install

You probably have two installations, for example an old npm install and a new native one. On macOS or Linux, list every claude on your PATH:

which -a claude

Keep one (Anthropic recommends the native install) and remove the others, for example the npm copy:

npm uninstall -g @anthropic-ai/claude-code

Login problems

  • API Error: 403 Request not allowed after login: for Pro or Max, check your subscription is active in claude.ai settings. For Console accounts, an admin must give you the Claude Code or Developer role on the Members page.
  • OAuth error: Invalid code: the code expired or was cut off. Retry and finish quickly, or press c to copy the full URL.
  • "This organization has been disabled" despite an active subscription: an old ANTHROPIC_API_KEY in your shell profile is overriding your login. Remove it from your profile and unset it (the command is in our API key guide).
  • Logged out repeatedly: check that your system clock is accurate, since token validation depends on it, then log in again.

For a clean restart of login, type this inside Claude Code, close it, then run claude again and sign in:

/logout

Prefer not to use a terminal?

Anthropic also offers Claude Code in a Desktop app for macOS, Windows and Linux, on the web at claude.ai/code, and as extensions for VS Code and JetBrains IDEs. You still need an eligible paid plan or a Console account. To keep the command-line version current later, see How to update Claude Code.

Frequently asked questions

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

No, not for the native installer, Homebrew, WinGet or the Linux package managers. Only the npm method needs Node.js, and Anthropic requires Node.js 22 or later for it. Even then, the installed claude command doesn't use Node at runtime.

›Is Claude Code free?

No. Claude Code needs a Pro, Max, Team or Enterprise plan, a Claude Console account billed at API rates, or access through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. The free claude.ai plan doesn't include Claude Code access.

›Can I install Claude Code on Windows without WSL?

Yes. Use the PowerShell or CMD installer, or WinGet, all shown in this guide. Git for Windows is optional; without it, Claude Code uses PowerShell for shell commands. On Windows, sandboxing needs WSL 2.

›Why does my terminal say 'claude: command not found' after installing?

Open a new terminal first. If it still fails, the install directory (~/.local/bin on macOS and Linux, %USERPROFILE%\.local\bin on Windows) isn't on your PATH. The troubleshooting section above shows how to add it.

›Which install method updates automatically?

The native installer updates itself in the background, and so do npm installs when the npm global directory is writable. Homebrew, WinGet, apt, dnf and apk installs need manual upgrades by default.

›Do I need administrator rights to install Claude Code?

Not for the native installer, which installs into your home folder on every platform. The apt and dnf repository setup uses sudo because it changes system package sources, and Anthropic advises against using sudo with npm.

›How much memory does Claude Code need?

Anthropic lists 4 GB of RAM or more as a system requirement. The installer itself needs roughly 512 MB of free memory, and on small Linux servers adding swap space lets the install finish.

›Can I use Claude Code with an API key instead of a subscription?

Yes. Log in with a Claude Console account, or set ANTHROPIC_API_KEY and approve it when Claude Code asks. Usage is then billed from purchased Console credits at API rates. Max and Team plans' monthly API credits don't cover Claude Code.

Sources

Checked against these pages on Oct 17, 2026. Providers change offers often: always confirm on the official page before you rely on it.

  1. Official: Claude Code advanced setup (code.claude.com)(code.claude.com)
  2. Official: Claude Code quickstart(code.claude.com)
  3. Official: Claude Code authentication(code.claude.com)
  4. Official: Troubleshoot installation and login(code.claude.com)
  5. Official: Claude Code CLI reference(code.claude.com)
  6. Official: Anthropic supported countries(www.anthropic.com)