Home

Install Claude Code on Mac

Claude Code is an AI assistant that lives in your Terminal and helps you write, debug, and understand code. Think of it as having a knowledgeable coding partner available whenever you need help. Whether you’re a complete beginner or an experienced developer, Claude Code can accelerate your workflow and help you learn.

This guide walks you through installation step by step, with detailed instructions for beginners.

Overview

Key Concepts

What You’ll Need

Step 1: Open Terminal

Tip: Keep Terminal open for the next steps.

Step 2: Install Claude Code

In Terminal, copy and paste this command, then press Return:

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

Alternative: Install with Homebrew

If you use Homebrew, you can install Claude Code with:

brew install --cask claude-code

Tip: Run claude doctor after installation to check that everything is set up correctly.

Step 3: Connect to Your Anthropic Account

Option A. Use your Claude Pro or Max subscription

Option B. Use Anthropic API key

If you have an Anthropic API key instead of a Claude subscription:

Note: If you’re using an older Mac with bash instead of zsh, replace ~/.zshrc with ~/.bash_profile in the command above.

Option C. Use OpenRouter API (starts for free!)

OpenRouter is a unified API gateway that provides access to 500+ large language models through a single API key. This can be an economical way to use Claude Code, as you pay only for usage and can choose from models at various price points.

Notes:

Option D. Use Anthropic API via Azure Foundry

This option is for organizations using Azure-hosted Claude models. In the Terminal window, paste this code to define environment variables (before starting Claude):

# Enable Microsoft Foundry integration
export CLAUDE_CODE_USE_FOUNDRY=1
# Azure resource name
export ANTHROPIC_FOUNDRY_RESOURCE=xxxx-eastus2
# Set models to your resource's deployment names
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-5
export ANTHROPIC_FOUNDRY_API_KEY=your_api_key

Note: Replace xxxx-eastus2 with your Foundry Resource name (do not use the entire base URL). Replace your_api_key with your complete API key from your Azure portal.

Step 4: Test Claude Code

You’re all set! Here’s how to use Claude Code:

Step 5: Navigate to Your Project

Note: Claude operates inside a project folder. It defines writing permissions in the folder and saves settings in that folder. It’s Claude’s workspace.

Step 6: Update Claude Code

Claude Code installed via the native installer automatically updates itself in the background. You can also manually trigger an update:

Note: Homebrew installations do not auto-update. Run brew upgrade claude-code periodically to get the latest version.

Next Steps

How to Open Terminal Again

After closing Terminal, here’s how to open it again:

Troubleshooting

First step: Run Claude Doctor

If something isn’t working, run this command first:

claude doctor

It checks your installation and reports any issues.

Installation script fails

Claude Code commands not found

Authentication fails

Tips for Mac Users

Finding Project Paths

To find the path to a folder:

Using Different Terminal Apps

You can also use other terminal apps like:

Claude Code works with all of them!

Need Help?


Last updated: February 2026