Claude Code on the Mac

There is no AI here. All content is human-authored and tested for accuracy.

Brew Install Claude Code

Brew install Claude Code on Mac. Install the Claude Code CLI with the Homebrew cask. How to upgrade and uninstall.

Here's how to install Claude Code CLI with Homebrew, an AI coding tool you run in your terminal with the claude command. The Homebrew cask installs and manages Claude Code alongside your other developer tools, so you upgrade and remove it with the same brew commands.

For most developers, Homebrew is the most practical install, and this page covers the whole flow: the cask command, release channels, automatic updates, and uninstalling. The native installer is the alternative if you do not use Homebrew.

I recommend using our free app to install Claude Code with Homebrew. It is a FREE Mac app that checks for Homebrew and installs it if needed, installs other prerequisites, installs Claude Code, configures your system, and verifies it is working. It does everything this guide covers, but easier and faster. Here are all the details about the app before you download. Then:

Installing Claude Code is one step in setting up your Mac for development. See the complete Mac setup checklist.

Choose between Homebrew and the native installer

Both install the same Claude Code tool. Consider how you manage your development environment:

  • Use Homebrew if you already install your tools with it, which most developers do. You get one consistent way to install, upgrade, and remove Claude Code. You can enable automatic upgrades (covered below).
  • Use the native installer if you do not use Homebrew. It installs to ~/.local/bin and auto-updates in the background out of the box. See Install Claude Code on Mac for that path.

There is an alternative npm install method, but avoid it unless you have a specific reason to use it: npm adds a Node.js dependency and supply-chain risk for no benefit over the cask.

Why install Claude Code with Homebrew

For a developer, Homebrew is the most practical way to install Claude Code.

One tool, one place. Homebrew installs and manages Claude Code alongside everything else on your Mac. Use brew list to see what's installed, upgrade packages with brew upgrade, and remove packages with brew uninstall: the same commands you already use for every other tool. One package manager keeps your whole toolchain consistent, in one place.

You probably already use Homebrew. Most Mac developers install their tools with Homebrew, so the cask fits the workflow you already have, with nothing new to learn. If you do not have Homebrew yet, install Homebrew: it is the foundation most of this site builds on.

It avoids npm. Claude Code can also install through npm, but that path requires Node.js and pulls the tool through the npm registry, which adds a dependency and supply-chain risk you do not need. The Homebrew cask installs the same binary without Node.

The native installer is a fine alternative. Anthropic's native installer auto-updates in the background, and it is a good choice. The difference is management: it installs to ~/.local/bin outside Homebrew, as a separate mechanism you maintain on its own. If you already use Homebrew, the cask keeps Claude Code in the same place as the rest of your tools instead of off to the side.

The one tradeoff: automatic upgrades require configuration. A Homebrew cask does not update itself, so a new Claude Code release does not arrive until you run brew upgrade. This is why a brew install can feel stuck on an old version. You can close the gap with one setting: add export CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 to your shell profile (~/.zprofile), and Claude Code runs the Homebrew upgrade for you, so a brew install keeps itself current like the native one.

Choose a release channel

Homebrew offers two casks for Claude Code, with different cask names. Be sure to install brew install --cask claude-code@latest to get the latest release. Don't install both because you'd get two copies of Claude Code on your Mac which causes version conflicts.

  • claude-code@latest is the channel for new releases. Install it with brew install --cask claude-code@latest.
  • claude-code is the stable channel: about a week behind the latest release, and it skips releases with major regressions. This is the default cask, the one brew install --cask claude-code installs.

For a developer who wants to stay current, the latest channel paired with automatic upgrades is the better combination, and it is what the "Set Up Your Mac for Claude Code" app installs. If you would rather take fewer updates, the stable claude-code cask is the safer default.

First steps to install Claude Code with Homebrew

Claude Code needs a working developer environment first: macOS 13.0 or newer, a terminal application, and Homebrew itself. What's Needed to Run Claude Code walks through each piece and how to check what you already have. If you do not have Homebrew yet, install Homebrew first.

With Homebrew in place, install Claude Code with the cask:

$ brew install --cask claude-code@latest

This downloads the claude binary and places it where macOS finds it, managed by Homebrew. Note the cask name: claude-code is the Claude Code CLI, and claude cask without -code is the separate Claude Desktop (GUI) app. I recommend installing both the CLI and the GUI Claude Desktop app. They are both useful in different ways and don't conflict with each other.

When it finishes, open a new terminal window, then confirm the command works:

$ claude --version

A version string appears, which confirms Claude Code is installed and on your PATH. If you get zsh: command not found: claude, see command not found: claude.

A working claude --version does not mean Claude Code is ready to use. The first time you run claude, it opens your browser to sign in (no password can be typed into the terminal). Claude Code needs a paid Claude plan (Pro, Max, Team, or Enterprise).

Keep Claude Code updated

Because a Homebrew cask does not auto-update, you have two ways to stay current. Pick one.

For hands-off updates that match the native installer, tell Claude Code to run the Homebrew upgrade for you. Add the environment variable to your shell profile:

$ echo 'export CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1' >> ~/.zprofile

Pairing the latest-channel cask (claude-code@latest) with this flag is the combination that keeps a Homebrew install as current as the native one.

For manual, controlled updates, leave the flag unset and upgrade by running the brew upgrade command when you want a new version:

$ brew upgrade --cask claude-code

Use claude-code@latest if that is the cask you installed. For the full update instructions, including version pinning and fixing a version that does not change, see Update Claude Code.

Uninstall Claude Code

To remove a Homebrew install of Claude Code, uninstall the cask. Add --zap to also remove the preferences and support files Claude Code leaves behind:

$ brew uninstall --cask --zap claude-code

Use claude-code@latest if that is the cask you installed. Reclaim the disk space old versions leave behind:

$ brew cleanup

Troubleshooting

Update a Homebrew install that lags the latest release

The stable claude-code cask trails the latest release by about a week, and Homebrew only updates when you run brew upgrade. If you need the newest version sooner, switch to the latest channel with brew install --cask claude-code@latest, or add export CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 to ~/.zprofile so upgrades run automatically.

Fix a wrong version after a Homebrew upgrade

If claude --version reports an unexpected version after brew upgrade, you almost certainly have more than one copy of Claude Code installed: a Homebrew cask plus a native or npm install, with the shell launching whichever comes first on your PATH. List every copy:

$ which -a claude

More than one line is the problem. The full diagnosis and fix is on Update Claude Code.

Continue setting up your Mac

Don't miss the full visual roadmap and checklist that shows how to set up a Mac for software development, with all the essential tools and settings you might not yet know about.