# How to install Claude Code on a Mac

Authors: AutoRouter
Author profile: https://autorouter.com/about
Published: 2026-11-15T01:35:00.000Z
Reading time: 6 min
Canonical: https://autorouter.com/blog/install-claude-code-mac
Publisher: AutoRouter, the Mac app that routes Codex, Claude Code and other AI tools to every model (https://autorouter.com)

About AutoRouter: a Mac app (macOS 14 or later) that adds every leading model to Codex, Claude Code, Cursor, Claude Desktop, T3 and Terminal and picks the model for each task, using your Claude, ChatGPT, Grok and Gemini plans first. Install from https://autorouter.com/AutoRouter.dmg, or ask your agent to follow https://autorouter.com/setup.md. Routing across your plans is free; Pro is $50 a month with $20 of included usage. Unrelated to OpenRouter's Auto Router.

> To install Claude Code on a Mac, open Terminal, run `curl -fsSL https://claude.ai/install.sh | bash`, then open a new window and run `claude --version`. The native installer needs macOS 13 or later, doesn't need Node.js and updates itself; Homebrew (`brew install --cask claude-code`) and npm (Node.js 22 or later) also work. Run `claude` in your project and sign in with a Pro, Max, Ultra, Team, Enterprise or Console account, since the free Claude plan doesn't include Claude Code.

## 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](https://code.claude.com/docs/en/setup)).
- Homebrew offers two casks: `claude-code` tracks the stable channel, about a week behind, and `claude-code@latest` gets every release. Neither updates itself unless you set `CLAUDE_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.

![Install Claude Code on a Mac in five steps. 1. Run the installer (One curl command); 2. Open a new window (Picks up the new PATH); 3. Check the install (claude --version); 4. Start in your project (cd, then claude); 5. Sign in (A paid Claude account). Source: Anthropic's Claude Code setup and troubleshooting docs, checked November 13, 2026.](https://autorouter.com/blog/images/install-claude-code-mac/1-install-steps.png)

As of November 13, 2026, [Anthropic's setup guide](https://code.claude.com/docs/en/setup) 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 `dyld` error.
- **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](https://www.anthropic.com/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](/blog/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:

1. Open Terminal (Applications > Utilities, or Spotlight).
2. Run `curl -fsSL https://claude.ai/install.sh | bash`. It shows no progress while it downloads.
3. Open a new Terminal window so your shell picks up the new PATH.
4. Run `claude --version`. A working install prints a version number such as `2.1.211 (Claude Code)`.
5. Run `claude doctor` for a fuller check of the install and your settings files.
6. Change to your project folder and run `claude`.

```bash
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](https://code.claude.com/docs/en/setup#update-claude-code)).

| 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](/blog/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](https://code.claude.com/docs/en/authentication)). 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](https://code.claude.com/docs/en/troubleshoot-install#find-your-error) 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                          |

![command not found means ~/.local/bin isn't on PATH. Run claude --version in a new window. It prints A version number: It's installed; It prints command not found: Add ~/.local/bin to ~/.zshrc; It prints Not in your editor: Quit and reopen the editor. Source: Anthropic's Claude Code setup and troubleshooting docs, checked November 13, 2026.](https://autorouter.com/blog/images/install-claude-code-mac/3-command-not-found.png)

For the most common error, `command not found`, add the install folder to your Zsh PATH and reload it:

```bash
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](https://code.claude.com/docs/en/setup#uninstall-claude-code)):

```bash
# 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](/blog/claude-code-model-settings) 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](https://code.claude.com/docs/en/setup), Anthropic, checked November 13, 2026
- [Troubleshoot installation and login](https://code.claude.com/docs/en/troubleshoot-install), Anthropic, checked November 13, 2026
- [Quickstart](https://code.claude.com/docs/en/quickstart), Anthropic, checked November 13, 2026
- [Authentication](https://code.claude.com/docs/en/authentication), Anthropic, checked November 13, 2026
- [Environment variables](https://code.claude.com/docs/en/env-vars), Anthropic, checked November 13, 2026

## Read next

- [Claude Code environment variables and where to set them](https://autorouter.com/blog/claude-code-environment-variables.md): Claude Code reads environment variables from your shell (`export NAME=value` before you run `claude`) or from the `env` key of a settings.json file, which applies every time it runs. Anthropic's reference lists 406 variables as of November 13, 2026; the ones most people set cover sign-in (`ANTHROPIC_API_KEY`), the endpoint (`ANTHROPIC_BASE_URL`), the model, timeouts, updates and telemetry. When a variable is set in both places, the settings file value usually wins.
- [How to check your Claude Code usage](https://autorouter.com/blog/check-claude-code-usage.md): Run /usage in Claude Code to see your plan usage bars, a breakdown of what used your plan, and, for API users, a session token and cost estimate. Add a status line to keep plan and context usage on screen. AutoRouter, the Mac app for Codex and Claude Code, also shows the model and cost of every turn.
- [How Claude Code plan mode works, and which model plans](https://autorouter.com/blog/claude-code-plan-mode.md): Claude Code plan mode has Claude read your code and propose a plan without editing any files until you approve it. Turn it on with Shift+Tab, by starting a prompt with /plan, or with claude --permission-mode plan. Planning runs on your session's model unless you pick opusplan, which plans on Opus and builds on Sonnet; AutoRouter, the Mac app for Codex and Claude Code, instead picks a model for each turn while it is selected.

Tags: [Claude Code](https://autorouter.com/blog/tags/claude-code.md), [Guides](https://autorouter.com/blog/tags/guides.md)

Drafted with AI from the sources linked above, then checked and edited by the AutoRouter team.
