Claude Code on Mac: install, Keychain, terminal setup and sleep
Install Claude Code on macOS 13+ (Apple silicon or Intel) with the installer, Homebrew or npm; fix zsh PATH, Keychain sign-in, Option key, notifications and sleep.
On a Mac, run curl -fsSL https://claude.ai/install.sh | bash in Terminal, open a new window, and run claude to sign in. It needs macOS 13 (Ventura) or later and runs natively on both Apple silicon and Intel. The installer puts the command at ~/.local/bin/claude; if zsh says command not found: claude, add that folder to your PATH in ~/.zshrc. Homebrew works too (brew install --cask claude-code, the stable channel), but does not update itself. Your sign-in is kept in the macOS Keychain. A session stops while the Mac sleeps, and closing a MacBook’s lid sleeps it even with idle sleep turned off, so long unattended work belongs on a machine that stays on. As of December 2, 2026 the newest release is 2.1.334 and the stable channel is on 2.1.331.
Three ways to install, and which suits a Mac
| Method | Command | Updates | Where claude lands |
|---|---|---|---|
Native installer | curl -fsSL https://claude.ai/install.sh | bash | Itself, in the background | ~/.local/bin/claude |
Homebrew, stable | brew install --cask claude-code | brew upgrade claude-code | /opt/homebrew/bin/claude on Apple silicon |
Homebrew, latest | brew install --cask claude-code@latest | brew upgrade claude-code@latest | The same |
npm | npm install -g @anthropic-ai/claude-code@latest | Itself, if npm’s global folder is writable without sudo | npm’s global bin folder |
Anthropic’s setup page recommends the native installer. It shows no progress while it downloads, needs no Node.js and no administrator password, and keeps itself current on the latest channel; add -s stable after bash to follow the channel that runs about a week behind instead. The binary is signed by “Anthropic PBC” and notarized by Apple; codesign --verify --verbose on the file checks the signature yourself.
Homebrew picks the channel by cask name: claude-code is stable, claude-code@latest gets every release. Neither updates itself unless you set CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1, after which Claude Code runs the brew upgrade for you and asks you to restart. Homebrew also keeps each old version on disk, so brew cleanup now and then gets the space back. If brew answers Error: Cask 'claude-code' is unavailable, your copy of Homebrew’s index is older than the cask: run brew update and try again. Homebrew’s own requirements matter on older Macs: it supports macOS 15 Sequoia and later, calls macOS 11 to 14 “unsupported but may work”, and classes every Intel Mac as a “Tier 3” configuration. On an Intel Mac or anything before Sequoia, the native installer is the surer route.
npm needs Node.js 22 or later, and installs the same native binary through a platform package (@anthropic-ai/claude-code-darwin-arm64 or -darwin-x64), so Node is not used once it is in place. Never install it with sudo: an install that needs it cannot update itself. Whichever you pick, keep only one; installing Claude Code shows how to find and remove a second copy, and covers the sign-in choices.
macOS versions, Apple silicon and Intel
Claude Code needs macOS 13.0 or later, 4 GB of RAM, and an ARM64 or x64 processor: Apple silicon and Intel Macs alike, each with its own build, which the installer picks for you; uname -m shows which you have. Two failures are Mac-specific:
dyld: Symbol not found,dyld: cannot loadorAbort trap: 6means the binary is too new for your macOS. Homebrew’s cask page lists Big Sur and Monterey among its platforms, but the troubleshooting page is plain that Homebrew downloads the same binary and “won’t resolve this error”. The fix is updating macOS to 13 or later.Illegal instructionon an old Intel Mac usually means the processor predates the instructions the binary uses, which Anthropic puts at “roughly pre-2013 Intel and AMD processors.” No install method changes that.sysctl -n machdep.cpu.brand_stringnames your CPU for a bug report.
The desktop app, for comparison, is one universal build for Intel and Apple silicon.
zsh: command not found: claude
zsh is the Mac’s default shell, and the usual first-day problem is that ~/.local/bin is not on its PATH. Add it to ~/.zshrc:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcCopiedIf the first line prints zsh: permission denied: /Users/you/.zshrc, you cannot write to the file and nothing was saved. Check its owner with ls -l ~/.zshrc. If the owner is root, take it back, which asks for your password:
sudo chown $(whoami) ~/.zshrcCopiedIf you already own it, it is read-only: chmod u+w ~/.zshrc fixes that. Then run the two PATH lines again and open a new Terminal window. A Mac running bash instead reads ~/.bash_profile, not ~/.bashrc; that case is in the install guide.
Where it keeps things on a Mac
| Path | What it is |
|---|---|
~/.local/bin/claude | The launcher, a symlink to the version in use (native install) |
~/.local/share/claude/versions/ | The installed versions; the updater keeps the two newest |
~/.claude/ | Your user settings (settings.json) and session history |
~/.claude.json | The rest of your user configuration |
The login Keychain | Your sign-in, encrypted |
~/.claude/.credentials.json | Your sign-in only when the Keychain refused it (below) |
~ is /Users/you. Between them, ~/.claude/ and ~/.claude.json hold your settings, allowed tools, MCP server configurations and session history, which is why a reinstall picks up where you left off.
Your sign-in is in the Keychain, unless it was locked
On Linux and Windows Claude Code keeps its sign-in in a file. On a Mac, Anthropic’s authentication page says, it goes into “the encrypted macOS Keychain.” That has one consequence people meet when they SSH into a Mac, such as a Mac mini left on at home: in an SSH session the login Keychain can be locked. When the Keychain rejects the write, Claude Code saves the login in the plaintext file ~/.claude/.credentials.json (readable only by you, mode 0600) instead, the same storage it uses on Linux. A Console sign-in that creates an API key fails outright until the Keychain is writable. The same happens when the Keychain’s password has drifted out of step with your account password.
To move the login back into the Keychain, run claude doctor and look for a warning that starts with macOS Keychain is not writable. If its fix says “Unlocking the Keychain won’t help”, as it can in a sandboxed shell, follow that fix instead. Otherwise unlock the Keychain; the command prompts for your Keychain password, so it never sits in your shell history:
security unlock-keychain ~/Library/Keychains/login.keychain-dbCopiedIf the warning stays, open Keychain Access, select the login keychain and choose Edit > Change Password for Keychain “login” to bring it back in line with your account password. Once claude doctor is clean, Claude Code moves the login back the next time it writes one; /logout then /login does it now, at the cost of signing out of MCP servers and clearing stored plugin secrets too. Claude Code 2.1.329 fixed repeated sign-outs on Macs where it could read the Keychain but not save to it, so update first if you keep being asked to log in.
Two more Keychain details. Setting CLAUDE_CONFIG_DIR gives each configuration folder its own Keychain entry, which is how two accounts stay signed in at once (an alias such as alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' in ~/.zshrc). And claude auth status --text prints a Sign-in ends: line saying when the stored login expires.
Terminal.app and iTerm2
Enter sends the prompt in every terminal. For a new line, Ctrl+J or \ then Enter work everywhere. Shift+Enter works out of the box in iTerm2, Ghostty, Kitty, WezTerm and Warp; Apple’s Terminal is not among them. Some shortcuts use the Option key, Option+Enter for a newline and Option+P to switch models among them, and most Mac terminals do not send Option as a modifier until you tell them to:
- Terminal.app: Settings, Profiles, Keyboard, tick “Use Option as Meta Key”.
/terminal-setup(and the prompt on first run) ticks it for you only on macOS 26 and earlier, and also turns off the profile’s audible bell. - iTerm2: Settings, Profiles, Keys, General, set Left and Right Option key to “Esc+”. Here
/terminal-setupturns on “Applications in terminal may access clipboard” so/copyreaches your clipboard; restart iTerm2 after it.
Terminal.app does not support the escape code that lets a program on a server set your clipboard, so copying out of a remote session works in iTerm2 with that setting on, and not in Terminal. The full table, tmux and the VS Code terminal are in the Claude Code new line guide.
Getting a notification when Claude finishes
When Claude finishes or stops for a permission prompt while you seem to be away, it raises a notification. What you get depends on the terminal:
- iTerm2 sends a macOS notification, once its alerts are on: Settings, Profiles, Terminal, tick “Notification Center Alerts”, then Filter Alerts and “Send escape sequence-generated alerts”. Ghostty and Kitty send one with no setup.
- Terminal.app makes no sound. With the profile’s audible bell off (as
/terminal-setupleaves it), Claude Code sends a silent bell, which shows only as a window flash or a Dock bounce if the profile’s visual bell or Dock bounce is on.
To hear a bell in any terminal, set this in ~/.claude/settings.json and, in Terminal.app, turn Audible bell back on under Settings, Profiles, Advanced:
{
"preferredNotifChannel": "terminal_bell"
}CopiedFor a real macOS notification from Terminal.app or the VS Code terminal, a Notification hook can call osascript; it runs beside the built-in notification rather than replacing it:
{
"hooks": {
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'"
}
]
}
]
}
}CopiedThe catch is permission. osascript posts through the Script Editor app, and if Script Editor may not send notifications the command fails silently and macOS never asks. Run this once so Script Editor appears in the list:
osascript -e 'display notification "test"'CopiedNothing shows yet. Open System Settings, Notifications, find Script Editor, turn on Allow Notifications, and run it again. A sound alone is simpler: afplay /System/Library/Sounds/Glass.aiff as the hook’s command.
When the Mac sleeps, the session stops
Claude Code runs as a process on your Mac. While the Mac sleeps it does nothing, and sleeping mid-request has caused errors on waking (2.1.126 fixed one, “Stream idle timeout”). Claude Code appears to hold off some sleep itself: its changelog at 2.1.83 fixed a caffeinate process “not properly terminating when Claude Code exits, preventing Mac from sleeping”, and a user’s report on Anthropic’s tracker describes it holding caffeinate -i during active sessions. Anthropic’s docs do not describe this, and -i only stops idle sleep. It does nothing about a closed lid: in Anthropic’s desktop docs, “Closing the laptop lid still puts it to sleep.”
To keep a Mac awake for one long run, start Claude under caffeinate. Its manual page says that given a command, it holds its assertions for as long as that command runs. -i prevents idle sleep and -s prevents system sleep, the latter “valid only when system is running on AC power”:
caffeinate -is claudeCopiedFor a session already running, caffeinate -is -w followed by its process ID holds the Mac awake until that process exits. The lasting setting is in System Settings: on a laptop, Battery, Options, “Prevent automatic sleeping on power adapter when the display is off”; on a Mac mini, iMac or Studio, Energy, “Prevent automatic sleeping when the display is off”. The desktop app has its own switch, Keep computer awake, under Settings, Desktop app (or Settings, This computer, System), which also prevents idle sleep only.
None of this survives a closed lid or a restart, and -s and the laptop setting hold only on power. Remote Control lets you watch and steer a Mac session from your phone, and it reconnects by itself after the laptop wakes, but in Anthropic’s words “your computer has to stay on” (Claude Code from your phone). For work that should carry on overnight or while the laptop is in a bag, run Claude Code on a machine that never sleeps, a Linux server you reach over SSH and keep sessions alive on with tmux: Claude Code on a VPS covers that setup, and choosing a VPS for Claude Code the size and the provider.
The desktop app’s Code tab, or the CLI
The Claude desktop app for Mac, one universal download, has Claude Code built in as its Code tab, so you can use it without Terminal at all. It writes to the same ~/.claude/ folder as the CLI and updates through Claude > Check for Updates… in its menu bar. Its computer use feature, Claude operating your Mac’s apps, needs macOS 14. What the tab does that the terminal does not, what only the CLI can do, and the app’s sessions on a server over SSH are in Claude Code on desktop.
Updating and removing it on a Mac
A native install updates itself on start-up and while running; the new version takes effect next launch, and claude update does it now. For Homebrew, run brew list --cask | grep claude-code to see which cask you have, then brew upgrade that one. For npm, run the install line again; npm update -g can leave you behind. Channels, pinning and failed updates are in how to update Claude Code.
To remove it, run /logout first if you want the saved sign-in gone, then the line for how you installed it:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claudeCopiedbrew uninstall --cask claude-codeCopiednpm uninstall -g @anthropic-ai/claude-codeCopiedThat leaves your settings and history. The next two lines delete them for good: every setting, allowed tool, MCP server and past session. Uninstall the desktop app and the VS Code or JetBrains extension first if you have them, or they recreate ~/.claude:
rm -rf ~/.claude
rm ~/.claude.jsonCopiedThe rest, old ~/.claude/local installs and the editor extensions included, is in uninstalling Claude Code.