The Problem
You try to run claude on macOS and hit one (or all) of these:
- Binary conflict —
/opt/homebrew/bin/claudealready exists from an old npm global install - Node.js v26 crash — the CLI launches via Node.js v26.0.0 and immediately crashes
- Gatekeeper block — “Apple could not verify claude is free of malware”
This guide walks through the complete fix I used to get Claude Code v2.1.149 running cleanly.
Root Cause
The install is half-conflicting: Homebrew tries to install the new claude-code cask, but /opt/homebrew/bin/claude already exists from a previous npm install -g @anthropic-ai/claude-code. The existing binary runs through Node.js v26.0.0, which is too new and causes compatibility crashes.
Step 1: Identify the Conflict
# See what currently owns the claude binary
which claude
ls -l /opt/homebrew/bin/claudeIf it points to a Node.js script or npm global, that’s your problem.
Step 2: Remove the Old npm Install
# Remove the global npm package
npm uninstall -g @anthropic-ai/claude-code
# Remove the stale binary if still there
rm -f /opt/homebrew/bin/claudeStep 3: Reinstall via Homebrew Cask
# Clean install of the official cask
brew install --cask claude-code
# Verify
claude --versionExpected output:
2.1.149 (Claude Code)Step 4: Fix Node.js Version (If Still Crashing)
If Claude still launches via Node and crashes, switch from v26 to LTS:
brew uninstall node
brew install node@22
brew link --overwrite --force node@22
# Verify
node -v # Should show v22.x.x
claude # Should work nowStep 5: Fix macOS Gatekeeper Block
When you see “Apple could not verify claude is free of malware”:
Option A — System Settings UI:
- Run
claude(it will fail) - Go to System Settings → Privacy & Security → Security
- Click “Open Anyway” (appears for about 1 hour after the blocked attempt)
- Run
claudeagain
Option B — Terminal (if you trust the Homebrew source):
xattr -dr com.apple.quarantine /opt/homebrew/bin/claude
xattr -dr com.apple.quarantine /opt/homebrew/Caskroom/claude-code
claudeStep 6: Nuclear Option (Clean Reinstall)
If nothing else works:
brew uninstall --cask claude-code
rm -f /opt/homebrew/bin/claude
brew install --cask claude-code
claudeFirst-Time Setup
Once Claude Code launches, you’ll see the welcome screen with a theme selector:
1. Auto (match terminal)
2. Dark mode ✔
3. Light mode
4. Dark mode (colorblind-friendly)
5. Light mode (colorblind-friendly)
6. Dark mode (ANSI colors only)
7. Light mode (ANSI colors only)Use arrow keys to select, press Enter. You can change this later with /theme.
Summary
| Problem | Fix |
|---|---|
| Binary conflict | npm uninstall -g @anthropic-ai/claude-code then brew install --cask claude-code |
| Node.js v26 crash | Switch to node@22 via Homebrew |
| Gatekeeper block | System Settings → Open Anyway, or xattr -dr com.apple.quarantine |