How to install Claude Code on Mac, Windows and Linux
Install Claude Code with the native installer, Homebrew, WinGet, apt or npm on macOS, Windows, WSL and Linux; sign in, fix command not found, verify it.
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 winget install Anthropic.ClaudeCode. On a Mac with Homebrew, brew install --cask claude-code also works. Then open a new terminal, check with claude --version, and run claude to sign in through your browser. You need a paid Claude plan (Pro, Max, Ultra, Team or Enterprise) or an Anthropic Console account; the free plan does not include Claude Code. npm still works too (npm install -g @anthropic-ai/claude-code@latest, Node.js 22 or later), but it is not the recommended route.
What your machine needs
Anthropic’s setup page lists, as of November 2026:
- Operating system: macOS 13.0 or later; Windows 10 1809 or later, or Windows Server 2019 or later; Ubuntu 20.04+, Debian 10+ or Alpine Linux 3.19+. Fedora and RHEL get their own package repository.
- Hardware: 4 GB of RAM or more, on an x64 or ARM64 processor. The install itself needs “roughly 512MB of free memory”, so a very small cloud server can be killed partway through.
- Shell: Bash, Zsh, PowerShell or CMD. On Alpine, install
bashandcurlfirst (apk add bash curl); the installer fails withnot foundwithout them. - Network and location: an internet connection, in one of Anthropic’s supported countries.
The native installer needs no Node.js and no administrator rights. Node only matters if you choose npm. Git is optional.
Install it
The native installer (recommended)
Pick the line for your terminal:
# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell (prompt starts with PS C:\)
irm https://claude.ai/install.ps1 | iex
# Windows CMD (prompt starts with C:\ and no PS)
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdCopiedIt shows no progress while it downloads, so give it a moment. On macOS and Linux it puts a launcher at ~/.local/bin/claude that links to the real executable under ~/.local/share/claude/versions/; on Windows the program is %USERPROFILE%\.local\bin\claude.exe. This copy updates itself in the background, which is the main reason to prefer it.
Piping a script into a shell runs whatever the address serves. If you want to check what you got, the macOS binary is signed by “Anthropic PBC” and notarized by Apple, the Windows one is signed by “Anthropic, PBC”, and each release publishes checksums in a signed manifest; the steps are under binary integrity on the setup page.
Homebrew (macOS)
brew install --cask claude-code # stable channel, about a week behind
brew install --cask claude-code@latest # every release as it shipsCopiedA Homebrew install does not update itself: you run brew upgrade claude-code (or the @latest name) when you want a new version.
WinGet (Windows)
winget install Anthropic.ClaudeCodeCopiedAlso manual to update, with winget upgrade Anthropic.ClaudeCode. For Homebrew and WinGet, setting CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 has Claude Code run the upgrade for you.
apt, dnf or apk (Linux)
Anthropic publishes signed repositories for Debian and Ubuntu, Fedora and RHEL, and Alpine. Updates then come with your normal system upgrades rather than from Claude Code. The apt commands, with the key fingerprint to check, are in Claude Code on Linux, which also covers a server with no browser.
npm: still supported
npm install -g @anthropic-ai/claude-code@latestCopiedAnthropic’s docs do not call npm deprecated; they list it under advanced options, behind the native installer. The package needs Node.js 22 or later and installs “the same native binary as the standalone installer”, so Node is not used once it is in place. Never use sudo with it: Claude Code updates an npm install by running npm without sudo, so an install that needed sudo cannot update itself. If npm --version starts with 12, the docs have a separate fix, because npm 12 skips the step that puts the binary in place; the native installer avoids both problems.
Which to choose
| Method | Updates itself | Default channel |
|---|---|---|
Native installer | Yes, in the background | latest (or pass stable) |
Homebrew | No | By cask: claude-code is stable |
WinGet | No | – |
apt, dnf, apk | No, system upgrades | stable, as in the docs’ commands |
npm | Yes, if npm’s global folder is writable without sudo | @latest, as in the docs’ command |
Use one method only: in Anthropic’s words, “Multiple Claude Code installations can cause version mismatches or unexpected behavior.”
Windows: native or WSL
Claude Code runs natively on Windows without administrator rights. Git for Windows is optional: without it Claude runs its shell commands in PowerShell, with it Claude also gets Bash through Git Bash. Choose WSL 2 instead for Linux toolchains or for Claude’s command sandbox, which native Windows does not support. In WSL you run the Linux curl line inside the WSL terminal, not from PowerShell or CMD. The trade-offs, the shell settings and the Windows-only errors are in Claude Code on Windows, and setting up WSL itself is in how to install WSL2.
Check the install
claude --version # e.g. 2.1.332 (Claude Code)
claude doctor # install health, settings errors, warnings with fixesCopiedRun these in a new terminal window. claude doctor prints read-only diagnostics without starting a session, so it is the one to run when claude itself will not start. As of November 25, 2026, npm’s tags for the package put the newest release at 2.1.332 and the stable channel at 2.1.326; npm view @anthropic-ai/claude-code dist-tags shows the current pair.
“command not found: claude”
The message depends on the shell: zsh: command not found: claude on a Mac, bash: claude: command not found on Linux, and 'claude' is not recognized on Windows. Almost always the program is installed but its folder is not on your PATH. The installer says so under Setup notes: at the end of its output (“Native installation exists but ~/.local/bin is not in your PATH”), and, in the troubleshooting page’s words, “prints the fix with that note but doesn’t change PATH itself.”
First confirm the file exists, then add its folder for your shell:
ls -la ~/.local/bin/claude
# zsh, the macOS default
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
# bash on Linux
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
# bash on macOS
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bash_profile && source ~/.bash_profileCopiedBash on a Mac is the trap: Terminal starts it as a login shell, which ignores ~/.bashrc and reads only the first of ~/.bash_profile, ~/.bash_login or ~/.profile that exists, so put the line in whichever of those you already have. For fish or Nushell, add ~/.local/bin in that shell’s own syntax. In PowerShell:
Test-Path "$env:USERPROFILE\.local\bin\claude.exe" # True: it is installed
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')CopiedIn CMD, add %USERPROFILE%\.local\bin to your User PATH under Environment Variables. Then open a new terminal: a window that was already open keeps its old PATH, and a terminal inside VS Code or another editor takes its PATH from the editor, so restart the editor too. Installing only the VS Code extension does not give you a claude command at all; it bundles a private copy for its own panel.
If an older version answers, or the wrong one, list every copy your shell can see:
which -a claude # where.exe claude on Windows
npm -g ls @anthropic-ai/claude-code 2>/dev/null
ls -la ~/.claude/local/ # a legacy npm install from older versionsCopiedAnthropic’s advice is to keep one, preferably the native install, and remove the others with their own uninstall command (npm uninstall -g @anthropic-ai/claude-code, rm -rf ~/.claude/local, brew uninstall --cask claude-code or winget uninstall Anthropic.ClaudeCode). On a Linux server there is one more case, a command run over SSH, from cron or from a service that never reads your shell files; Claude Code on Linux covers that.
First run and sign-in
cd /path/to/your/project
claudeCopiedClaude Code asks you to log in the first time and opens your browser. It accepts a Claude subscription (Pro, Max, Ultra, Team or Enterprise), an Anthropic Console account, which is API access paid with pre-paid credits, or a cloud provider: Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry. The free claude.ai plan does not include Claude Code; what each plan gives you is in which Claude plans include Claude Code. To sign in again later, type /login inside the session.
If ANTHROPIC_API_KEY is set in your environment, Claude Code asks whether to use it, and approving it skips the browser sign-in. An old key left in a shell profile can override your subscription; Anthropic’s fix is unset ANTHROPIC_API_KEY, removing it from the profile, and checking with /status. On a machine with no browser, open the link Claude Code prints on another device and paste back the code it shows (press c to copy a link that wraps), or run claude auth login; the full server walk-through is in the Linux guide. For scripts and scheduled runs with nobody there to sign in, claude setup-token gives a long-lived token, and Not logged in · Please run /login is the error to expect when neither is in place.
Updates and release channels
A native install “checks for updates on startup and periodically while running” and the new version takes effect the next time you start Claude Code; claude update does it now. There are two channels: latest, the default, gets every release as it ships, and stable is “typically about one week old, skipping releases with major regressions”. The channel you install with becomes the default for updates:
curl -fsSL https://claude.ai/install.sh | bash -s stable # stable channel
curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89 # one exact version
# PowerShell
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stableCopiedSwitching channels later, holding a version and the update errors are in how to update Claude Code.
Install errors worth knowing
Killed, or an install that stops with exit code 137 on a small server. This usually means the machine ran out of memory. Add swap or use a larger machine; Anthropic’s swap commands are in the Linux guide.syntax error near unexpected token '<'or a 403. The install address returned a web page instead of the script, usually a proxy or network filter, or Claude Code is not offered in your country.- The wrong line for the shell on Windows.
'irm' is not recognizedmeans you are in CMD;The token '&&' is not a valid statement separatormeans you ran the CMD line in PowerShell. dylderrors on a Mac. The binary does not match your macOS version or hardware; Claude Code requires macOS 13.0 or later.- npm
EACCESpermission errors. Switch to the native installer rather than rerunning withsudo.
The full list, with fixes for TLS, proxies and WSL 1, is Anthropic’s install troubleshooting page. To remove a native install, delete ~/.local/bin/claude and ~/.local/share/claude; your settings and session history stay in ~/.claude and ~/.claude.json for a reinstall; every method’s removal, and the data too if you want it gone, is in uninstalling Claude Code.