Skip to content
86% off$349 $48.86code BF2026

Guides

How to Install Claude Code on a Mac: Steps and PATH Fixes

Install Claude Code on a Mac with the native installer, Homebrew or npm, sign in, check it works, and fix "command not found" PATH issues on zsh, nvm and asdf.

GuideUpdated 9 min read

On this page

To install Claude Code on a Mac, open Terminal and run Anthropic's native installer: curl -fsSL https://claude.ai/install.sh | bash. Then open a new Terminal window, cd into a project folder, type claude and sign in. If you prefer a package manager, Homebrew (brew install --cask claude-code) and npm (npm install -g @anthropic-ai/claude-code) install the same tool.

If claude isn't found after installing, the cause is almost always the same: the folder that holds claude isn't on your shell's PATH. The fixes for zsh, nvm and asdf are further down.

Claude Code ships updates often. If a command here doesn't match what you see, treat the Claude Code documentation as the source of truth.

What you need before installing

  • Terminal. It's in Applications ▸ Utilities. You can also press ⌘Space (Command-Space) and type "Terminal".
  • A way to pay for the model. Claude Code needs a Claude subscription, an Anthropic Console account (pay per use through the API), or a supported third-party model provider. As of November 2026, Anthropic's support pages list Claude Code on the paid plans (Pro, Max, Ultra, Team and Enterprise), not on Free.
  • Node.js 18 or later, but only for the npm method. Check your version with node --version.
  • Homebrew, but only for the Homebrew method. Get it from brew.sh.
  • git, recommended. Claude Code edits files in whatever folder you start it in, and git lets you see and undo those edits. Run git --version to check. On a Mac without the Command Line Tools, running it offers to install them.

Which install method to pick

MethodNeedsUpdatesPick it if
Native installerNothing extraUpdates itselfYou want the simplest setup
HomebrewHomebrewYou run an upgrade commandYou already manage your tools with Homebrew
npmNode.js 18 or laterYou reinstall the latest versionYou already use global npm packages and stick to one Node version
SledbotSledbotUpdate… in Settings ▸ AgentsYou run several coding agents and want install, login and updates in one list

Choose the native installer unless you have a reason not to. npm works, but under nvm or asdf it ties claude to one Node version, so switching versions can make it disappear.

Install Claude Code with the native installer

  1. Open Terminal.

  2. Run the installer:

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

    This downloads Anthropic's install script and runs it. The script puts the claude command in ~/.local/bin and its files in ~/.local/share/claude.

  3. Close the Terminal window and open a new one so your shell picks up any PATH change.

  4. Check the install:

    bash
    claude --version

    You should see a version number. If you see zsh: command not found: claude, skip ahead to the PATH fixes below.

If you'd rather read the script before running it, download it first, open install.sh in a text editor, then run it:

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

The first line saves the script to the current folder without running it. The second runs it.

The native install doesn't need Node.js, and it keeps itself up to date in the background. Its one weak spot: ~/.local/bin isn't on the PATH of a new Mac user account.

Install with Homebrew or npm

Homebrew

bash
brew install --cask claude-code

This installs Claude Code as a Homebrew cask. A Homebrew install doesn't update itself, so run brew upgrade --cask claude-code from time to time.

If Terminal says zsh: command not found: brew, either Homebrew isn't installed or it isn't on your PATH. The Homebrew fix is in the PATH section below.

npm

bash
npm install -g @anthropic-ai/claude-code

This installs the claude command globally for the Node.js version you're currently using. Two things to watch:

  • Don't use sudo. If npm fails with an EACCES permission error, use the fix in the PATH section instead.
  • Under nvm or asdf, the install belongs to the active Node version. Switch versions and claude can vanish. The nvm and asdf fixes are below.

Log in: subscription or API key

  1. In Terminal, go to a project folder, for example:

    bash
    cd ~/Developer/my-app
  2. Start Claude Code:

    bash
    claude
  3. Choose how to sign in: with your Claude account (a paid plan) or with an Anthropic Console account (pay per use through the API).

  4. Finish signing in in the browser window that opens, then go back to Terminal.

To switch accounts later, type /login inside Claude Code. /logout signs you out.

Use an API key instead

Claude Code also reads the ANTHROPIC_API_KEY environment variable. For one session:

bash
export ANTHROPIC_API_KEY="your-key-here"
claude

This sets the key for the current Terminal window only and starts Claude Code with it. You can add the export line to ~/.zshrc to make it permanent, but the key then sits in a plain text file. Signing in through claude keeps it out of your dotfiles.

Check that it works

  • claude --version prints the installed version.
  • claude doctor reports how Claude Code was installed and flags common setup problems.
  • In a project, start with a read-only request such as "Summarize what this project does." It should read files and answer without changing anything.

Fix "command not found" and PATH issues on zsh

zsh is the default shell on current macOS, so these fixes assume zsh. First, find out where claude is:

bash
which -a claude
ls ~/.local/bin/claude

which -a lists every claude on your PATH, in the order the shell finds them. If it prints nothing but ls finds the file, the install worked and only the PATH entry is missing.

Add ~/.local/bin to your PATH

bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

The first line appends a PATH entry to ~/.zshrc. The second reloads that file in the current window. To undo, open ~/.zshrc in a text editor and delete the line.

Terminal reads ~/.zshrc in every new window. Some apps and scripts start a non-interactive login shell (zsh -lc), which reads ~/.zprofile but skips ~/.zshrc. If claude works in Terminal but not from another tool, add the same line to ~/.zprofile too.

nvm: claude disappears after switching Node versions

nvm keeps global npm packages separately for each Node version. Install Claude Code under Node 20, switch to Node 22, and claude is gone. You have three options:

  • Install it again in each Node version you use: npm install -g @anthropic-ai/claude-code.
  • When you install a new Node version, bring your global packages along: nvm install 22 --reinstall-packages-from=20.
  • Uninstall the npm copy and use the native installer, which doesn't depend on Node at all.

nvm itself is usually loaded from ~/.zshrc, so tools that don't read ~/.zshrc won't see nvm's Node or anything installed with it.

asdf: installed but not found

asdf runs commands through shims. After a global npm install, regenerate them:

bash
asdf reshim nodejs

This rebuilds asdf's shims for Node.js so the new claude command is found. It changes nothing else.

npm fails with EACCES

npm's global folder isn't writable by your user. Don't fix this with sudo. Use the native installer, install Node through nvm (which keeps global packages in your home folder), or point npm at a folder you own:

bash
npm config set prefix ~/.npm-global
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

The first line sets where npm installs global packages, the second adds that folder's bin to your PATH, and the third reloads your shell settings. Then run the npm install again. To undo, run npm config delete prefix and remove the line from ~/.zshrc.

Two copies, and the wrong one runs

If you installed with more than one method, which -a claude shows more than one path, and the first one wins. Run claude doctor to see which install is active, then uninstall the others (steps below).

brew: command not found

On Apple silicon Macs, Homebrew installs into /opt/homebrew, which isn't on the default PATH. If Homebrew is installed, add it:

bash
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

The first line sets Homebrew's PATH for every new shell, the second for the current one. To undo, delete the line from ~/.zprofile. On Intel Macs, Homebrew uses /usr/local/bin, which is already on the PATH. If /opt/homebrew/bin/brew doesn't exist, install Homebrew from brew.sh first.

The sign-in browser window doesn't open

Copy the sign-in link from the Terminal output and open it in your browser yourself. On a remote machine over SSH there's no browser, so open the link on your Mac and paste any code it shows back into the SSH session.

Update or uninstall Claude Code

Uninstalling the program leaves your settings and conversation history in place, so a reinstall picks up where you left off.

Native installer

It updates itself in the background. To check for an update now:

bash
claude update

To uninstall, remove the command and its files:

bash
rm ~/.local/bin/claude
rm -rf ~/.local/share/claude

The first line removes the claude command, the second removes the installed program files.

Homebrew

bash
brew upgrade --cask claude-code

This updates Claude Code to the latest version Homebrew has. To uninstall:

bash
brew uninstall --cask claude-code

npm

bash
npm install -g @anthropic-ai/claude-code@latest

This replaces your global install with the latest version. To uninstall:

bash
npm uninstall -g @anthropic-ai/claude-code

Under nvm or asdf, run these with the same Node version you installed under.

Remove settings and history too

This permanently deletes your Claude Code settings and conversation history. It can't be undone.

bash
rm -rf ~/.claude
rm ~/.claude.json

The first line deletes the ~/.claude folder, the second deletes the ~/.claude.json config file.

Install other agents next to it

Every coding agent is its own command-line tool with its own installer and login. Codex CLI, Gemini CLI and GitHub Copilot CLI all install separately. They don't conflict with Claude Code, but you end up maintaining several installs, logins and PATH entries.

If you run several agents, Sledbot, which we make, can handle the install and login steps from one place:

  • Settings ▸ Agents lists the coding agents Sledbot supports and shows "vendor · version" or "vendor · not installed" for each. Install…, Log in… and Update… open a confirm sheet, then run the vendor's own command in a terminal pane, so browser and device-code logins still work.
  • In New task, picking an agent that isn't installed asks "Install <Agent>?" and runs the vendor's install command in a terminal.
  • If you just installed something in Terminal and Sledbot still says "not installed", click Refresh in Settings ▸ Agents. Detection is cached for 60 seconds.
  • For nvm and asdf users: Settings ▸ General ▸ "Load ~/.zshrc when starting agents" (on by default) starts agents through an interactive login shell, so a claude that's only on your ~/.zshrc PATH is still found. With it off, Sledbot uses zsh -lc, which skips ~/.zshrc. This setting applies to agents on this Mac.

Sledbot doesn't replace Claude Code. It runs the claude you installed, under your own login, and it refuses to store Claude subscription login tokens. If you have more than one Claude login, Settings ▸ Accounts ▸ Add account… gives each one its own config folder so they don't overwrite each other. Sledbot is part of MacSuite; you can try it free for 7 days.

Next step: run your first task in a worktree

Claude Code edits files in the folder you start it in. Before you give it real work, give it a separate checkout so your own uncommitted changes stay untouched. A git worktree does that:

bash
cd ~/Developer/my-app
git worktree add -b claude/first-task ../my-app-claude
cd ../my-app-claude
claude

This creates a second checkout of the repo on a new branch, claude/first-task, and starts Claude Code there. When it's done, review the branch and merge what you want. Then remove the checkout with git worktree remove ../my-app-claude and the branch with git branch -d claude/first-task (-d only deletes a branch that has been merged).

In Sledbot, New task (⌘T) does this for you: "Work in a new worktree" is on by default for git repos, and Review changes lets you accept or reject each change before you merge. The Start an agent on a task doc has the details.

For more on this workflow, see Claude Code worktrees, running multiple Claude Code agents in parallel and the best Claude Code GUI apps for Mac.

FAQ

Do I need Node.js to install Claude Code?

Only for the npm method. The native installer and Homebrew don't need Node.js.

Can I use Claude Code without a paid Claude plan?

As of November 2026, Anthropic lists Claude Code on its paid plans, not Free. The alternatives are an Anthropic Console account, where you pay per use through the API, or a supported third-party model provider.

Why does claude work in one Terminal window but not another?

The working window has the updated PATH and the other doesn't, usually because it was opened before you edited ~/.zshrc. Open a new window or run source ~/.zshrc.

Where does Claude Code keep its settings?

In the ~/.claude folder and the ~/.claude.json file in your home folder. Uninstalling the program leaves them in place.

Every app.
One purchase.