How to Install Claude Code on Windows, macOS, and Linux

By Updated

How do you install Claude Code?

Claude Code installs with one command: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux, and WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. This method doesn't need Node.js. You need a Pro, Max, Ultra, Team, Enterprise, or Console account, or access through a cloud provider; the free claude.ai plan doesn't include Claude Code (Anthropic documentation, November 29, 2026).

TL;DR

  • -The native installer is the recommended method: it doesn't need Node.js and updates itself. Homebrew, WinGet, apt, dnf, and apk installs are updated manually by default.
  • -After installing, open a new terminal window and run claude --version. For detailed diagnostics without starting a session, run claude doctor.
  • -If the terminal can't find claude, add ~/.local/bin (on Windows %USERPROFILE%\.local\bin) to PATH. The installer doesn't change PATH itself.
  • -WSL is optional on Windows: the native install suits Windows projects, WSL 2 is for Linux tools and sandboxing. WSL 1 and native Windows have no sandbox.
  • -The ANTHROPIC_API_KEY variable can override your subscription: after you confirm it in interactive mode, always in -p mode. /status shows the active sign-in method.

Claude Code installs with one command and doesn’t need Node.js. Which command depends on your system and shell.

macOS, Linux, WSL (in WSL, run it inside the distribution):

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

Windows PowerShell (the prompt starts with PS C:\):

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

Windows CMD (the prompt is C:\ without PS):

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

The installer shows no download progress. When it finishes, open a new terminal window and check the result with claude --version: it prints a number like 2.1.211 (Claude Code). Then run claude in your project directory and sign in through the browser.

This guide covers installing Claude Code, signing in, and fixing common errors. Commands and requirements were checked against Anthropic’s documentation on November 29, 2026. The author works on macOS and tested the claude doctor diagnostics there. The macOS install itself and everything about Windows, WSL, and Linux follow the documentation.

What you need before installing Claude Code

RequirementValue per documentation
macOS13.0 or later
Windows10 version 1809 or later, Server 2019 or later, 64-bit only
LinuxUbuntu 20.04+, Debian 10+, Alpine 3.19+
Hardware4 GB RAM or more, x64 or ARM64 processor
ShellBash, Zsh, PowerShell, or CMD
Networkinternet access, including downloads.claude.ai
AccountPro, Max, Ultra, Team, Enterprise, Console, or a cloud provider
Countryon the supported list

Git is optional. You can skip the terminal too: there’s a Desktop app and extensions for VS Code and JetBrains. The sections below are about the CLI only.

Installation methods by operating system

Anthropic marks the native installer as recommended. The other methods make sense if a package manager already maintains the software on your system.

MethodCommandUpdates
Nativecommands at the top of this pageautomatic, in the background
Homebrew (macOS), stable channelbrew install --cask claude-codebrew upgrade claude-code
Homebrew (macOS), latest channelbrew install --cask claude-code@latestbrew upgrade claude-code@latest
WinGetwinget install Anthropic.ClaudeCodewinget upgrade Anthropic.ClaudeCode
apt (Debian, Ubuntu)repository and key, then sudo apt install claude-codesudo apt update && sudo apt upgrade claude-code
dnf (Fedora, RHEL)repository file, then sudo dnf install claude-codesudo dnf upgrade claude-code
apk (Alpine)key and repository, then apk add bash claude-codeapk update && apk upgrade claude-code

Repository setup and the signing key fingerprint are in Install with Linux package managers. On Alpine, the curl command needs apk add bash curl first, otherwise it ends with a not found error.

What install.sh does

Piping someone else’s script into | bash is worth a check first. According to the text of install.sh on November 29, 2026, it detects the platform, gets the latest version number and the manifest from downloads.claude.ai, downloads the binary, and verifies its SHA256 against the manifest. Then it runs claude install, which sets up the launcher and shell integration.

Under sudo from a regular user account, the script stops with Error: do not run this installer with sudo. Installing into your home directory doesn’t need root.

Verify the install: claude —version and claude doctor

claude --version answers one question: did the shell find the program? claude doctor prints install and settings diagnostics. It doesn’t start a session and changes nothing.

On the author’s machine (macOS, November 29, 2026, version 2.1.322), claude doctor showed:

  • the install method (npm-global) and path;
  • auto-update status: turned off by the DISABLE_AUTOUPDATER variable;
  • the channel and the last update attempt;
  • the warning Multiple installations found: npm-global and native at the same path.

The latest version on npm that day was 2.1.332. One command revealed two things that are hard to notice in daily work: updates are off, and two installations are registered. Remove the extra one when moving from npm.

Don’t confuse it with /doctor. That’s a command inside a session, and it can apply fixes itself after you confirm.

Claude Code on Windows: native or WSL 2

Per the documentation, Claude Code runs on Windows directly and inside WSL:

OptionWhat you needSandboxWhen to choose it
Native Windowsnothing, Git for Windows optionalnoWindows projects and tools
WSL 2WSL 2 enabledyesLinux tools or sandboxed commands
WSL 1WSL 1 enablednoWSL 2 is unavailable

Choose by where the project lives and what builds it. A project built in Visual Studio fits native Windows; one with bash scripts and a Linux toolchain fits WSL 2. On native Windows, the agent’s commands run without a sandbox, which is another argument for WSL 2.

For WSL, run the Linux command inside the distribution, not from PowerShell or CMD, and start claude there too.

On the native option, Git for Windows provides Git Bash, which the Bash tool uses. Without it, Claude Code uses PowerShell. If Git is in a non-standard location, set the path in settings.json:

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

Only a file named bash.exe, sh.exe, bash, or sh works. Claude Code ignores the git-bash.exe launcher.

First sign-in and the ANTHROPIC_API_KEY trap

On first launch, claude opens a browser. If it didn’t, press c: the sign-in URL is copied to the clipboard. If the browser shows a code, paste it into the terminal at Paste code here if prompted. A successful sign-in ends with Login successful.

In WSL 2, over SSH, and in containers, the browser often doesn’t open, or gets stuck on localhost after sign-in. The steps are the same: open the copied URL in a browser on your own machine and paste the code. If pasting into the prompt does nothing, use claude auth login, which reads the code from standard input.

Check the ANTHROPIC_API_KEY variable separately. According to the documentation, its key ranks above a subscription sign-in. In interactive mode, Claude Code asks for permission once and remembers the answer; in -p mode it uses the key without asking. That work is billed through the API even when your subscription is active. To see what the session uses, run /status.

Claude Code install errors: message, cause, fix

The tables hold 15 rows of typical messages. The selection is editorial; the texts and fixes come from Troubleshoot installation and login (November 29, 2026). The official table has 49 rows, so look up any other case there by its error text.

PATH and the wrong command

ErrorCauseFix
command not found: claude, 'claude' is not recognized as an internal or external command, The term 'claude' is not recognizedinstall directory not in PATHadd the directory to PATH, open a new window
zsh: permission denied: /Users/you/.zshrc (in Bash, the same for .bashrc)no write access to the shell file, so the PATH line wasn’t savedanother user owns it: sudo chown $(whoami) ~/.zshrc; you own it: chmod u+w ~/.zshrc; repeat
The token '&&' is not a valid statement separatorCMD command run in PowerShellirm https://claude.ai/install.ps1 | iex
'irm' is not recognized as an internal or external commandPowerShell command run in CMDopen PowerShell or use the install.cmd command
A parameter cannot be found that matches parameter name 'fsSL', 'bash' is not recognized as the name of a cmdletmacOS and Linux command run in Windows PowerShellirm https://claude.ai/install.ps1 | iex

Download, network, and memory

ErrorCauseFix
syntax error near unexpected token `<', < was unexpected at this time., System.Xml.XmlDocument, curl: (22) The requested URL returned error: 403a web page, XML, or an error code came back instead of the scriptretry in a few minutes; use Homebrew or WinGet; on 403 check the proxy; if the text contains App unavailable in region, the country isn’t supported
curl: (35) TLS connect error, Could not create SSL/TLS secure channelthe TLS handshake failedUbuntu and Debian: update ca-certificates; PowerShell 5.1: enable TLS 1.2; check the proxy
unable to get local issuer certificate, SELF_SIGNED_CERT_IN_CHAINa corporate proxy replaces the certificatemacOS and Linux: point CURL_CA_BUNDLE and NODE_EXTRA_CA_CERTS at your company’s PEM file; Windows: add the certificate to the store
Killed, Installation was killed before it could finish (exit code 137)not enough memory on Linux, the install needs about 512 MB freeclose processes, add swap, or use a larger machine

Windows and WSL

ErrorCauseFix
running scripts is disabled on this systemPowerShell policy blocks npm’s .ps1 launchersswitch to the PowerShell installer, call claude.cmd, or run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Claude Code on Windows requires either Git for Windows (for bash) or PowerShellneither Git Bash nor PowerShell was foundadd C:\Windows\System32\WindowsPowerShell\v1.0\ to PATH, install PowerShell 7 or Git for Windows
cannot execute binary file: Exec format error in WSLWSL 1 can’t load the binarywsl --set-version <DistroName> 2 from PowerShell

npm and sign-in

ErrorCauseFix
Error: claude native binary not installed.npm skipped postinstall (npm 12 does this by default) or the optional dependencyinstall with the native installer and remove the npm package
OAuth error: Invalid code, That doesn't look like the full codethe sign-in code expired or was copied only in partpress Enter to retry; copy the whole code, including the #
API Error: 400 ... "This organization has been disabled" with an active subscriptionan old ANTHROPIC_API_KEY overrides the subscriptionunset ANTHROPIC_API_KEY (PowerShell: Remove-Item Env:ANTHROPIC_API_KEY), remove the line from your shell profile

Two limits can’t be bypassed, per the documentation. A processor without AVX (roughly pre-2013) or a virtual machine that doesn’t pass AVX through gives Illegal instruction, and there’s no native-binary workaround. macOS older than 13.0 gives a dyld error, and Homebrew won’t help because the binary is the same. The documentation points to issues #50384 (AVX) and #38788 (the WSL 1 error from the table). Both were auto-closed for inactivity, in May and July 2026, as not planned, so don’t expect news of a fix there.

PATH step by step

The installer puts the program in ~/.local/bin/claude on macOS and Linux and in %USERPROFILE%\.local\bin\claude.exe on Windows. If the directory isn’t in PATH, it says so in the Setup notes: block but doesn’t change PATH.

First make sure the file is there, then add the directory. For Zsh, the default shell on macOS:

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

In Bash on Linux, use ~/.bashrc instead of ~/.zshrc; in Bash on macOS, ~/.bash_profile. Fish and Nushell need their own syntax.

In Windows PowerShell, the first line should print True:

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

From CMD, add the same directory through System Settings → Environment Variables. Then restart the terminal, and the editor too if the terminal is built into it.

The VS Code extension puts nothing in this directory: it has its own copy of the CLI inside the extension. If that’s all you have, there’s no claude command in the terminal.

Updates and the latest and stable channels

A native install checks for updates at startup and while running; the new version takes effect on the next start. To update manually, run claude update.

There are two channels. latest (the default) gets releases right away. stable is about a week behind and skips versions with major regressions. On November 29, 2026, the npm latest tag pointed to 2.1.332 from November 24 and stable to 2.1.326 from November 16. Change the channel in /config or in settings.json:

{
  "autoUpdatesChannel": "stable",
  "minimumVersion": "2.1.323"
}

minimumVersion prevents a downgrade below the given version when you switch to stable. Put your own number from claude --version there. The downside of stable: a new model may require a newer Claude Code.

Setting "DISABLE_AUTOUPDATER": "1" in the env block turns off background updates; claude update still works. DISABLE_UPDATES blocks every update path.

Moving from npm to the native install

The npm package is still available, but the repository README marks npm installation as deprecated, and the documentation recommends native. The binary is the same either way. The Node.js 18+ badge in the README is out of date: the documentation and the npm registry require Node.js 22 or later.

Steps for macOS, Linux, and WSL:

curl -fsSL https://claude.ai/install.sh | bash
npm uninstall -g @anthropic-ai/claude-code
which -a claude                  # every claude found
ls -la ~/.local/bin/claude       # symlink into ~/.local/share/claude/versions/
ls -la ~/.claude/local/          # old local npm install

If several installations remain, the documentation advises keeping only the native one. Earlier versions created the ~/.claude/local directory; delete it separately. When claude doctor shows npm and native at the same path, as on the author’s machine, check after npm uninstall that ~/.local/bin/claude is still there. If it’s gone, run the installer again.

The documentation doesn’t directly promise that settings and history survive a change of install method. Removing the npm package and deleting ~/.claude are described as separate steps, but back up ~/.claude and ~/.claude.json before you switch.

If you stay on npm, don’t install the package with sudo: self-update runs npm without it and will fail. Update with npm install -g @anthropic-ai/claude-code@latest, not npm update -g.

How to uninstall Claude Code

Install methodUninstall command
Native, macOS, Linux, WSLrm -f ~/.local/bin/claude and rm -rf ~/.local/share/claude
Native, WindowsRemove-Item for $env:USERPROFILE\.local\bin\claude.exe and $env:USERPROFILE\.local\share\claude (with -Recurse -Force)
Homebrewbrew uninstall --cask claude-code
WinGetwinget uninstall Anthropic.ClaudeCode
npmnpm uninstall -g @anthropic-ai/claude-code
apt, dnf, apkpackage, repository file, and key, commands in the docs

User data is separate, in ~/.claude and ~/.claude.json. Deleting it erases settings, permissions, MCP configuration, and session history. If claude still runs after you uninstall it, a second installation or an alias remains: look for it with which -a claude or where.exe claude.

Next steps

  1. Run claude doctor and clear its warnings before you start configuring.
  2. Check /status: you should be signed in with the method you intend to pay for.
  3. Describe the project in CLAUDE.md and move mandatory checks into hooks.
  4. Permissions, skills, subagents, and CI runs are covered in the complete Claude Code guide.
  5. Before connecting external systems, see how MCP differs from an API.

Sources

All pages were opened on November 29, 2026.

Frequently Asked Questions

Does Claude Code need Node.js?
Not for the native installer, Homebrew, WinGet, or the apt, dnf, and apk packages. For the npm package, the documentation requires Node.js 22 or later. The binary that npm installs doesn't call Node.js at runtime.
Does Claude Code work on Windows without WSL?
Yes. Per the documentation, you need Windows 10 1809 or later, or Windows Server 2019 or later. Administrator rights aren't required. Git for Windows is optional: without it, commands run through PowerShell. Sandboxing isn't supported on native Windows.
Should I use WSL 1 or WSL 2?
WSL 2, because sandboxing works there. The documentation suggests WSL 1 only where WSL 2 is unavailable, and it describes an Exec format error when the binary starts on WSL 1. To convert a distribution, run wsl --set-version with the distribution name and the number 2.
Can I use Claude Code for free?
The free claude.ai plan doesn't include Claude Code. You need a Pro, Max, Ultra, Team, or Enterprise account, a Claude Console account with API billing, or Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry.
Why does the terminal say command not found: claude after installation?
The install directory isn't in PATH, or the terminal window was opened before PATH changed. Check that ~/.local/bin/claude exists, add ~/.local/bin to your shell configuration, and open a new window. A terminal inside an editor inherits PATH from the editor, so restart the editor too.
How do I update Claude Code?
A native install updates in the background, and the new version takes effect on the next start. To update right away, run claude update. For Homebrew use brew upgrade claude-code, for WinGet winget upgrade Anthropic.ClaudeCode, and for npm reinstall the package with the @latest tag.
How do I uninstall Claude Code completely?
Remove the program the same way you installed it, then delete the ~/.claude directory and the ~/.claude.json file if you want your data gone too. That erases settings, MCP configuration, and session history. The VS Code extension, the JetBrains plugin, and the Desktop app recreate ~/.claude, so remove them first.