How to install Claude Code on a Mac
AutoRouter6 min read
Key facts
- Anthropic's recommended Mac install is
curl -fsSL https://claude.ai/install.sh | bash, which needs macOS 13.0 or later and updates itself in the background (Anthropic, checked November 13, 2026). - Homebrew offers two casks:
claude-codetracks the stable channel, about a week behind, andclaude-code@latestgets every release. Neither updates itself unless you setCLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1. - The npm package needs Node.js 22 or later, installs the same native binary, and should never be installed with
sudo. - Claude Code needs a Pro, Max, Ultra, Team, Enterprise or Console account; the free Claude plan doesn't include it.
As of November 13, 2026, Anthropic's setup guide recommends installing Claude Code on a Mac with one command in Terminal, curl -fsSL https://claude.ai/install.sh | bash. It needs macOS 13.0 or later, an Intel or Apple silicon Mac with 4 GB of RAM, and no Node.js. Open a new Terminal window afterwards, check it with claude --version, then run claude in a project folder and sign in in your browser. Homebrew and npm installs work too; the table below compares them.
What do you need before installing Claude Code on a Mac?
You need a supported Mac, a terminal and a paid Claude account:
- macOS 13.0 or later. Older versions fail with a
dylderror. - An x64 or ARM64 processor and 4 GB of RAM or more, so both Intel and Apple silicon Macs work.
- Zsh or Bash. Zsh is the macOS default.
- An internet connection, from one of Anthropic's supported countries.
- A Pro, Max, Ultra, Team, Enterprise or Console account. The free claude.ai plan doesn't include Claude Code. You can also use Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry.
Git is optional, and ripgrep usually comes with Claude Code. If you'd rather not use the terminal, Anthropic's Claude desktop app runs Claude Code in its Code tab. To compare what each Claude plan costs, see Claude Code pricing.
How do you install Claude Code with the native installer?
The native installer is Anthropic's recommended method, and it keeps Claude Code up to date on its own:
- Open Terminal (Applications > Utilities, or Spotlight).
- Run
curl -fsSL https://claude.ai/install.sh | bash. It shows no progress while it downloads. - Open a new Terminal window so your shell picks up the new PATH.
- Run
claude --version. A working install prints a version number such as2.1.211 (Claude Code). - Run
claude doctorfor a fuller check of the install and your settings files. - Change to your project folder and run
claude.
curl -fsSL https://claude.ai/install.sh | bash
# in a new Terminal window
claude --version
claude doctor
cd ~/code/my-project
claude
The installer places the claude launcher at ~/.local/bin/claude, linked to versions under ~/.local/share/claude/versions/. To install the stable channel, about a week behind the latest release, run curl -fsSL https://claude.ai/install.sh | bash -s stable; to pin a version, pass its number, such as bash -s 2.1.89.
Should you install Claude Code with Homebrew or npm instead?
Use Homebrew or npm only if you want Claude Code managed with your other packages; both install the same native binary but don't update themselves by default (Anthropic).
| Method | Install command | Needs Node.js | Updates | Update command |
|---|---|---|---|---|
| Native installer (recommended) | The curl command in the steps above | No | Automatic, in the background | claude update |
| Homebrew, stable | brew install --cask claude-code | No | Manual; about a week behind latest | brew upgrade claude-code |
| Homebrew, latest | brew install --cask claude-code@latest | No | Manual; every release | brew upgrade claude-code@latest |
| npm | npm install -g @anthropic-ai/claude-code@latest | Node.js 22 or later | Automatic if the npm global folder is writable | npm install -g @anthropic-ai/claude-code@latest |
To have Claude Code run the Homebrew upgrade for you, set CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1; Claude Code environment variables explains where to set it. Run brew cleanup now and then, because Homebrew keeps old versions on disk.
With npm, don't use sudo npm install -g: Anthropic warns it causes permission problems, and Claude Code can't update an install that needs sudo. Avoid npm update -g, which may not move you to the newest release. On a Node.js older than 22, npm prints an EBADENGINE warning but still installs.
How do you sign in to Claude Code after installing?
Run claude and follow the browser prompts to log in with your Claude account (Anthropic). If the browser doesn't open, press c to copy the sign-in URL and paste it into a browser yourself. On macOS, Claude Code saves your login in the login Keychain.
If ANTHROPIC_API_KEY is set in your shell, Claude Code asks whether to use the key; approve it and Claude Code bills the API key instead of your subscription. Run unset ANTHROPIC_API_KEY to go back to your plan.
How do you fix common Claude Code install errors on a Mac?
Most Mac install problems are a PATH that doesn't include ~/.local/bin, a network that returned a web page instead of the script, or an old macOS. Anthropic's troubleshooting page matches each message to a fix.
| What you see | What it means | Fix |
|---|---|---|
zsh: command not found: claude | ~/.local/bin isn't on your PATH | Add it to ~/.zshrc (below), then open a new window |
zsh: permission denied: /Users/you/.zshrc | You can't write to your shell config | chmod u+w ~/.zshrc, or sudo chown $(whoami) ~/.zshrc if another user owns it |
syntax error near unexpected token '<' or curl: (22) ... 403 | The install URL returned HTML, often from a proxy or blocked network | Check you can reach downloads.claude.ai, or use Homebrew |
curl: (23) or curl: (56) Failure writing output to destination | The script download was cut off | Retry, or use another install method |
Cask 'claude-code' is unavailable | Your Homebrew index is out of date | brew update, then install again |
dyld: Symbol not found or Abort trap: 6 | macOS is older than 13.0 | Update macOS; Homebrew installs the same binary |
EACCES: permission denied | The install folder isn't writable, often an old npm install | Switch to the native installer |
API Error: 403 Request not allowed after login | No active subscription or Console role | Check your plan at claude.ai/settings |
OAuth error: Invalid code | The login code expired or was cut off | Press Enter to retry, or press c to copy the full URL |
For the most common error, command not found, add the install folder to your Zsh PATH and reload it:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
claude --version
If you use Bash on macOS, add the line to ~/.bash_profile instead, because Terminal starts Bash as a login shell that ignores ~/.bashrc. A terminal inside an editor keeps the editor's old PATH until you quit and reopen the editor.
How do you update or uninstall Claude Code on a Mac?
A native install updates itself; run claude update to update now. Homebrew and npm installs use the update commands in the table above. To uninstall, remove the files for the method you used (Anthropic):
# native installer
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
# Homebrew (use claude-code@latest if that's the cask you installed)
brew uninstall --cask claude-code
# npm
npm uninstall -g @anthropic-ai/claude-code
If claude still runs after uninstalling, you probably have a second install from another method; brew list --cask | grep claude-code and which -a claude show where.
Questions
Do I need Node.js to install Claude Code on a Mac?
Not for the native installer or Homebrew, which install a standalone binary. The npm package needs Node.js 22 or later. Some tools that work with Claude Code ask for more: AutoRouter, the Mac app for Codex and Claude Code, lists Node 22.18 or later for Claude Code in its requirements.
Which Claude Code install method should I use on a Mac?
Use the native installer unless you manage everything through Homebrew. It is Anthropic's recommended method, and it is the only one that updates itself without extra setup.
How do I switch Claude Code to the stable release channel?
On a native install, run /config and change Auto-update channel, or set "autoUpdatesChannel": "stable" in ~/.claude/settings.json. On Homebrew, the channel is the cask: claude-code is stable and claude-code@latest is latest.
How do I change the model after installing Claude Code?
Type /model in a session, or start with claude --model sonnet. How to change the model in Claude Code lists every setting, and how to add an MCP server to Claude Code is a common next step. If you install AutoRouter, it appears in /model as one more choice that picks a model for each task.
Sources
- Advanced setup, Anthropic, checked November 13, 2026
- Troubleshoot installation and login, Anthropic, checked November 13, 2026
- Quickstart, Anthropic, checked November 13, 2026
- Authentication, Anthropic, checked November 13, 2026
- Environment variables, Anthropic, checked November 13, 2026