Native macOS installation with Homebrew. Optimized for both Intel and Apple Silicon Macs. The easiest platform to get started with Claude Code.
For experienced users - get Claude Code running in 3 commands
# Install Node.js (macOS with Homebrew)
brew install node
# Install Claude Code
npm install -g @anthropic-ai/claude-code
# Run Claude Code
claude
New to command line or development tools? Follow our detailed guide with explanations.
Experienced developer? Jump straight to advanced configurations and enterprise features.
Claude Code works natively on macOS with minimal requirements.
macOS Version | macOS 10.15 Catalina or later (recommended: macOS 12+) |
Processor | Intel x64 or Apple Silicon (M1/M2/M3) |
Memory | 4GB RAM minimum (8GB+ recommended) |
Storage | 1GB free space for Node.js and Claude Code |
Network | Internet connection for installation and API access |
Account | Claude Max subscription OR Anthropic API key |
Great News! macOS is the most straightforward platform for Claude Code installation. No virtualization or compatibility layers needed.
Follow these detailed steps to install Claude Code on macOS. Perfect for developers new to command line tools.
Homebrew is the most popular package manager for macOS. It makes installing development tools simple and reliable.
Homebrew is like an app store for command-line tools. It automatically handles downloads, installations, and updates for thousands of development tools including Node.js.
Open Terminal (⌘ + Space, type "Terminal") and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This command downloads and runs the official Homebrew installer. You'll be prompted for your password.
If you have an M1/M2/M3 Mac, you may need to add Homebrew to your PATH:
# Add Homebrew to PATH
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Check if Homebrew is installed correctly
brew --version
# Should output something like: Homebrew 4.x.x
Tip: If you see "command not found" for brew, restart Terminal or run the PATH command above.
Node.js is the JavaScript runtime that Claude Code requires. We'll install the latest LTS (Long Term Support) version.
# Install Node.js (includes npm)
brew install node
# Verify installation
node --version
npm --version
This installs both Node.js and npm (Node Package Manager) which we'll use to install Claude Code.
# Expected output (versions may be newer)
$ node --version
v20.x.x
$ npm --version
10.x.x
Set up npm to avoid permission issues with global packages:
# Create directory for global packages
mkdir -p ~/.npm-global
# Configure npm to use this directory
npm config set prefix ~/.npm-global
# Add to PATH in your shell profile
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
# Reload shell configuration
source ~/.zshrc
Success! Node.js is now installed and ready to use.
Now we can install Claude Code using npm. This downloads the latest version from the official repository.
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
The -g
flag installs Claude Code globally, making it available from any directory.
# Check if Claude Code is in PATH
which claude
# Should output something like: /usr/local/bin/claude or ~/.npm-global/bin/claude
If you encounter any issues on Apple Silicon, try:
# Force ARM64 architecture
arch -arm64 npm install -g @anthropic-ai/claude-code
Excellent! Claude Code is now installed on your Mac.
Configure Claude Code to work with your Anthropic account. You can use either Claude Max or an API key.
Best for regular users ($20/month):
claude
# Navigate to your project
cd ~/Projects/your-project
# Start Claude Code
claude
For pay-per-use or enterprise:
# Set API key
export ANTHROPIC_API_KEY=your_key_here
# Add to shell profile
echo 'export ANTHROPIC_API_KEY=your_key' >> ~/.zshrc
source ~/.zshrc
Note: macOS uses zsh as the default shell. If you're using bash, replace ~/.zshrc
with ~/.bash_profile
.
Test Claude Code with your first project and learn the basic workflow.
# Create a new project directory
mkdir ~/claude-test
cd ~/claude-test
# Create a simple JavaScript file
echo "console.log('Hello Claude!');" > hello.js
# Create a README
echo "# My First Claude Code Project" > README.md
# Start Claude Code in your project
claude
# Try some basic commands
> "Explain what this JavaScript file does"
> "/init" # Generate project documentation
> "/help" # See all available commands
> "/status" # Check system status
/init
- Generate CLAUDE.md documentation/help
- Show all available commands/model claude-sonnet-4
- Switch AI models/clear
- Clear conversation context/exit
- Exit Claude CodeCongratulations! You've successfully installed and tested Claude Code on macOS. You're ready to start AI-powered development!
Quick setup for experienced developers with advanced configurations and optimization tips.
Complete installation in a single command. Assumes you have Homebrew installed.
# Complete installation (if Homebrew is already installed)
brew install node && npm install -g @anthropic-ai/claude-code
# Or full installation from scratch
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
brew install node && \
npm install -g @anthropic-ai/claude-code
# Quick verification
claude --version && echo "✅ Claude Code installed successfully"
Optimize your macOS development environment for Claude Code.
Add to ~/.zshrc
or ~/.bash_profile
:
# Claude Code environment
export ANTHROPIC_API_KEY=your_key
export CLAUDE_MODEL=claude-sonnet-4
export MCP_DEBUG=false
# Node.js optimization
export NODE_OPTIONS="--max-old-space-size=4096"
# npm global packages
export PATH=~/.npm-global/bin:$PATH
# Homebrew (Apple Silicon)
eval "$(/opt/homebrew/bin/brew shellenv)"
Create ~/.claude.json
:
{
"defaultModel": "claude-sonnet-4",
"permissions": {
"allowedTools": ["Edit", "Bash(git*)"],
"deniedTools": ["Bash(rm*)"]
},
"preferences": {
"autoCompact": true,
"compactThreshold": 50000
},
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "~/Projects"]
}
}
}
Set up Claude Code with popular macOS development environments.
# Install VS Code extension
code --install-extension anthropic.claude-code
# Connect Claude Code to VS Code
claude /ide
# Use keyboard shortcuts
# Cmd+Esc to access Claude Code
# iTerm2 integration
echo 'alias cc="claude"' >> ~/.zshrc
# Terminal optimization
claude /terminal-setup
# Add to iTerm2 profile for quick access
# Cmd+T -> New tab with claude auto-start
Set up Model Context Protocol servers for enhanced capabilities.
# Install essential MCP servers
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-github
npm install -g @modelcontextprotocol/server-puppeteer
# Quick MCP setup
claude mcp add filesystem -s user -- npx -y @modelcontextprotocol/server-filesystem ~/Projects
claude mcp add github -s user -- env GITHUB_TOKEN=your_token npx -y @modelcontextprotocol/server-github
Create .claude.json
in your project root:
{
"mcpServers": {
"project-filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "./"]
},
"project-specific": {
"command": "npx",
"args": ["-y", "@your-org/custom-mcp-server"]
}
}
}
Optimize Claude Code performance on macOS for large projects.
# Increase Node.js memory limit
export NODE_OPTIONS="--max-old-space-size=8192"
# For large codebases
export NODE_OPTIONS="--max-old-space-size=16384"
# Add to shell profile
echo 'export NODE_OPTIONS="--max-old-space-size=8192"' >> ~/.zshrc
# Exclude large directories
echo "node_modules/
.git/
dist/
build/
*.log" > .claudeignore
# Use SSD for better performance
# Keep projects on internal SSD, not external drives
Make the most of Claude Code on macOS with these platform-specific optimizations.
Action | Shortcut |
---|---|
Open Terminal | ⌘ + Space → "Terminal" |
New Terminal Tab | ⌘ + T |
Claude Code in IDE | ⌘ + Esc |
Paste in Terminal | ⌘ + V |
Clear Terminal | ⌘ + K |
claude
cd ~/Projects && claude
Right-click in Finder and select "New Terminal at Folder"
# Create alias for quick access
echo 'alias ccd="cd \$1 && claude"' >> ~/.zshrc
# Usage: ccd ~/Projects/my-project
# Create app bundle (advanced)
# Use Platypus or create Automator application
# Set to run: cd ~/Projects && claude
Solutions to common issues specific to macOS installations.
# Check Xcode Command Line Tools
xcode-select --install
# If already installed, reset
sudo xcode-select --reset
# Fix Homebrew permissions
sudo chown -R $(whoami) /opt/homebrew
# For Intel Macs
sudo chown -R $(whoami) /usr/local
# Add Homebrew to PATH (Apple Silicon)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# For Intel Macs
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
# Check npm global directory
npm config get prefix
# Add to PATH if needed
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
# Force ARM64 architecture
arch -arm64 npm install -g @anthropic-ai/claude-code
# Check architecture
uname -m # Should show arm64 for Apple Silicon
# Check DNS resolution
nslookup api.anthropic.com
# Test connectivity
curl -I https://api.anthropic.com
Congratulations! You've successfully installed Claude Code on macOS. Here's what to explore next:
Need help? Check our troubleshooting guide or visit the community resources.