Claude CodeBeginner

How to Install Claude Code on macOS

Install the Claude Code CLI on a Mac, authenticate it, and confirm the install works before you point it at a real project.

7 minBeginner

Claude Code is a command line tool that runs Anthropic's coding agent inside your terminal, against the files in your project. Before you can use it you need it installed and signed in. This guide covers a clean install on macOS using the native installer, plus a fallback through npm if you prefer to manage it that way.

What you need

  • A Mac running macOS 13 or newer
  • Terminal access (the built-in Terminal app or iTerm)
  • An Anthropic account, or a Claude Pro / Max subscription, or an API key
  • About 5 minutes

Step 1: Run the native installer

The simplest path is the official install script, which downloads a self-contained binary and does not require you to manage Node yourself. Open Terminal and paste the command below.

zsh - install
$curl -fsSL https://claude.ai/install.sh | bash
Downloading Claude Code...
Installed to ~/.local/bin/claude
Add ~/.local/bin to your PATH if it is not already there
$

Step 2: (Alternative) install with npm

If you already manage tools with Node, you can install the package globally instead. This works on any platform that has Node 18 or newer.

terminal
node --version   # should print v18 or higher
npm install -g @anthropic-ai/claude-code
Do not use sudo
If npm asks for sudo, your global prefix points at a system directory. Fix the prefix or use the native installer instead. Installing global npm packages with sudo causes permission errors later.

Step 3: Authenticate

Run claude once to start the login flow. It opens a browser where you sign in with your Anthropic account or paste an API key. After that, the token is cached so you stay signed in.

Terminal - first launch
$ claude
Welcome to Claude Code
Choose login method:
> Claude account (Pro / Max)
Anthropic API key
Opening browser to authenticate...
The login prompt on the very first run.

Step 4: Verify the install

Check the version and run the built-in diagnostics. If both succeed, you are ready to open a project.

zsh - verify
$claude --version
2.1.0 (Claude Code)
$claude doctor
All checks passed.
$
Terminal - claude doctor
$ claude doctor
[ok] binary on PATH
[ok] authenticated as you@example.com
[ok] config writable at ~/.claude
All checks passed.
claude doctor confirms PATH, auth, and the install location.
Keep it current
Run claude update (native install) or npm update -g @anthropic-ai/claude-code (npm install) every week or two. The CLI ships fixes and new features often.

Result: typing claude in any folder now launches the agent. In the next guide you will point it at an actual project and run your first task.

Watch related tutorials

Tags
#install#macos#cli#setup#node