Guide
How to install Claude Code on Mac, Linux and Windows
The one-line installer, every package manager, what you need first, how to sign in, and the fix for each common install error.
To install Claude Code, open a terminal and run one command: curl -fsSL https://claude.ai/install.sh | bash on Mac, Linux or WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. Then open a new terminal, run claude --version to check it worked, and run claude in your project folder to sign in. You need a Claude Pro, Max, Team or Enterprise plan, or an Anthropic Console account; the free Claude plan "does not include Claude Code access." Homebrew, WinGet, apt, dnf, apk and npm work too, and if you'd rather not use a terminal at all, the Claude desktop app runs Claude Code in a window.
Key takeaways
- Mac, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bash - Windows:
irm https://claude.ai/install.ps1 | iexin PowerShell, no Administrator rights needed (Windows guide). - Requirements: macOS 13, Windows 10 1809, Ubuntu 20.04, Debian 10 or Alpine 3.19 or later, and 4 GB of memory.
- Account: Pro, Max, Team, Enterprise or a Console account. The free plan doesn't include it.
- Updates: the native installer updates itself; package-manager installs don't.
- Most common error:
command not found: claude, fixed by adding~/.local/binto your PATH.
| Method | Command | Systems | Updates itself |
|---|---|---|---|
| Native installer | curl -fsSL https://claude.ai/install.sh | bash | macOS, Linux, WSL | Yes |
| Native installer | irm https://claude.ai/install.ps1 | iex | Windows PowerShell | Yes |
| Homebrew | brew install --cask claude-code | macOS | No; brew upgrade |
| WinGet | winget install Anthropic.ClaudeCode | Windows | No; winget upgrade |
| apt, dnf, apk | From Anthropic's signed repositories | Debian, Ubuntu, Fedora, RHEL, Alpine | With system updates |
| npm | npm install -g @anthropic-ai/claude-code | Any, with Node.js 22+ | Yes, if npm's folder is writable |
| Desktop app | Download from claude.com | macOS, Windows, Linux | Yes |
How do you install Claude Code on a Mac?
Open Terminal (press Cmd+Space and type Terminal) and run:
curl -fsSL https://claude.ai/install.sh | bash
The installer shows no progress while it downloads. When it finishes, open a new Terminal window and run claude --version, which prints a version number such as 2.1.211 (Claude Code) (Anthropic). It installs claude in ~/.local/bin and keeps itself up to date.
With Homebrew instead:
brew install --cask claude-code
The claude-code cask follows the stable channel, about a week behind the newest release and skipping ones with major regressions; claude-code@latest gets every release as it ships. Homebrew installs don't update themselves: run brew upgrade claude-code now and then.
How do you install Claude Code on Linux?
The same one-line installer works on Ubuntu, Debian, Fedora, Alpine and WSL:
curl -fsSL https://claude.ai/install.sh | bash
Anthropic also publishes signed package repositories, which update with the rest of your system:
- Debian and Ubuntu (apt): add Anthropic's signing key to
/etc/apt/keyrings, add thedownloads.claude.ai/claude-code/apt/stablerepository, thensudo apt install claude-code. - Fedora and RHEL (dnf): add a repo file pointing at
downloads.claude.ai/claude-code/rpm/stable, thensudo dnf install claude-code. - Alpine (apk): add the key and the
downloads.claude.ai/claude-code/apk/stablerepository, thenapk add claude-code.
Anthropic's setup page has the exact commands and the key fingerprint to check, 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE. On Alpine and other musl systems, install bash, curl, libgcc, libstdc++ and ripgrep first and set USE_BUILTIN_RIPGREP=0.
On a small server: installing needs roughly 512 MB of free memory, and a Killed message means Linux ran out. Add a 2 GB swap file or use a larger machine; Claude Code itself needs 4 GB.
How do you install Claude Code on Windows?
Open PowerShell from the Start menu (not as Administrator) and run:
irm https://claude.ai/install.ps1 | iex
In Command Prompt the command is curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd, and WinGet works too: winget install Anthropic.ClaudeCode. Or install inside WSL with the Linux command. Which to choose, Git for Windows, and the Windows-only errors are in how to install Claude Code on Windows.
Can you install Claude Code with npm?
Yes, though Anthropic recommends the native installer:
npm install -g @anthropic-ai/claude-code
It needs Node.js 22 or later, and installs the same native binary as the installer, so Node isn't used once it's running. Never use sudo npm install -g: Anthropic warns it "can lead to permission issues and security risks." To upgrade, run npm install -g @anthropic-ai/claude-code@latest, not npm update -g.
How do you sign in after installing?
Run claude in your project folder and follow the browser prompt. Claude Code needs one of:
- A Claude subscription: Pro, Max, Team or Enterprise. Usage counts against your plan's limits (Claude Code pricing).
- An Anthropic Console account, billed per token at API rates (Claude API pricing).
- A cloud provider: Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry.
If you set the ANTHROPIC_API_KEY environment variable and approve it, Claude Code uses that key instead of your plan, and bills it.
On a remote machine, WSL or a container, where no browser opens or the browser can't reach localhost: copy the login URL the terminal shows (press c), open it on your own computer, sign in, and paste the code it gives you back at the Paste code here prompt. claude auth login does the same from the shell (Anthropic).
How do you update or uninstall Claude Code?
- Update now:
claude update. The native install also updates itself in the background, on thelatestchannel by default; set"autoUpdatesChannel": "stable"in settings for a version about a week old. - Check the install:
claude doctorreports install health, the last update attempt and settings errors without starting a session. - Install a specific version:
curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89, orbash -s stablefor the stable channel. - Uninstall the native install:
rm -f ~/.local/bin/claudeandrm -rf ~/.local/share/claude. For Homebrew,brew uninstall --cask claude-code; for npm,npm uninstall -g @anthropic-ai/claude-code.
Your settings and history live in ~/.claude and ~/.claude.json; delete them only if you want to remove everything.
Why does it say "command not found: claude"?
The install worked but the folder it put claude in, ~/.local/bin, isn't on your PATH yet. On a Mac with Zsh:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
On Linux with Bash, use ~/.bashrc instead; with Bash on a Mac, ~/.bash_profile. Then open a new terminal. A terminal inside an editor takes its PATH from the editor, so restart the editor too.
Other common install errors
From Anthropic's troubleshooting page (Anthropic):
syntax error near unexpected token '<'or a 403: the install URL returned a web page instead of the script, usually because a proxy or network filter blocked it, or Claude Code isn't available in your country. Check withcurl -sI https://downloads.claude.ai/claude-code-releases/latest, which should show200.- Behind a corporate proxy: set
HTTPS_PROXYandHTTP_PROXYto the proxy's address before running the installer. TLS connect errororunable to get local issuer certificate: update your CA certificates, or configure your company's certificate.EACCES: permission denied: usually an npm install; switch to the native installer.App unavailable in region: Claude Code isn't offered in your country.claudestill runs an old version: you have two installs.claude doctorshows which one runs.
After it's installed
Your first session, permission modes, the VS Code extension and the habits that help are in how to use Claude Code, and what it costs in Claude Code pricing. If you'd rather skip the install entirely, Poly (usepoly.co) runs Claude Code in the browser in a shared room, where a team works with one agent together and nothing needs installing. Free to start. What is Poly?
Common questions
How do I install Claude Code?
On Mac, Linux or WSL run curl -fsSL https://claude.ai/install.sh | bash. On Windows run irm https://claude.ai/install.ps1 | iex in PowerShell. Then open a new terminal, run claude --version to check, and run claude to sign in.
Is Claude Code free to install?
Installing is free, but using it needs a Claude Pro, Max, Team or Enterprise plan or an Anthropic Console account. The free Claude plan doesn't include Claude Code.
Does Claude Code need Node.js?
No. The native installer, Homebrew, WinGet and the Linux packages need no Node.js. Only the npm install method does, and it needs Node.js 22 or later.
What are the system requirements for Claude Code?
macOS 13, Windows 10 1809 or Windows Server 2019, Ubuntu 20.04, Debian 10 or Alpine 3.19 or later, an x64 or ARM64 processor, 4 GB of memory and an internet connection.
Why is the claude command not found after installing?
The folder it installs into, ~/.local/bin on Mac and Linux, isn't on your PATH. Add it to your shell's config file, such as ~/.zshrc, and open a new terminal.