Claudebeginner

How to Install Claude Code CLI on Mac and Windows

Step-by-step instructions for installing Claude Code CLI on macOS and Windows. Set up Anthropic's agentic coding tool in your terminal with native installers or package managers.

7 min readUpdated January 2025

Want us to handle this for you?

Get expert help →

Claude Code is an agentic coding tool from Anthropic that lives in your terminal. It understands your codebase, executes routine tasks, explains complex code, and handles git workflows - all through natural language commands.

Prerequisites

Before installing Claude Code, ensure you have:

  • A Claude subscription (Pro or Max recommended) OR an Anthropic account with billing enabled
  • At least 4GB of RAM
  • Terminal access (Terminal on macOS, PowerShell/CMD on Windows)

Installing on macOS

macOS has three installation options, with the native installer being recommended.

The easiest method - no Node.js required:

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

The installer is signed by "Anthropic PBC" and notarized by Apple.

Option 2: Homebrew

If you prefer Homebrew:

brew install --cask claude-code

Note: Homebrew installations do not auto-update. Run brew upgrade claude-code to update manually.

Option 3: npm (Deprecated)

The npm method is deprecated but still works:

npm install -g @anthropic-ai/claude-code

If you have an existing npm installation, migrate to native by running:

claude install

Installing on Windows

Windows now supports native installation without WSL (as of version 2.x).

Open PowerShell and run:

irm https://claude.ai/install.ps1 | iex

This installs Claude Code natively on Windows - no WSL required.

Option 2: WinGet

If you prefer WinGet:

winget install Anthropic.ClaudeCode

Note: WinGet installations do not auto-update. Run winget upgrade Anthropic.ClaudeCode to update manually.

Option 3: WSL (Optional)

While no longer required, WSL 2 still provides benefits:

  • Sandboxing support for enhanced security (WSL 1 does not support sandboxing)
  • Better compatibility with Unix-based tooling

To install in WSL:

  1. Open your WSL terminal

  2. Run the install script:

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

Option 4: npm (Deprecated)

npm install -g @anthropic-ai/claude-code

Authentication

After installation, authenticate with your Anthropic account:

  1. Start Claude Code:
claude
  1. Follow the browser authentication flow to sign in with your Claude.ai account

Subscription Options

  • Claude Pro/Max (Recommended): Subscribe at claude.ai for a unified subscription that includes both Claude Code and Claude on the web
  • Anthropic API: Alternatively, use an Anthropic account with billing enabled and API credits

Verify Installation

After authentication, verify your installation:

claude --version

Run the diagnostic tool to check for issues:

claude doctor

This shows your installation type, version, and any potential problems.

Basic Usage

Navigate to your project directory and start Claude Code:

claude

Common tasks:

# Ask questions about your codebase
claude "explain how the authentication system works"

# Generate code
claude "write unit tests for the user service"

# Handle git workflows
claude "create a commit for my changes with a descriptive message"

# Refactor code
claude "refactor this function to use async/await"

Updating Claude Code

Native installations auto-update by default. For package manager installations:

Homebrew:

brew upgrade claude-code

WinGet:

winget upgrade Anthropic.ClaudeCode

Migrating from npm to native:

claude install

Troubleshooting

"command not found: claude"

If the command is not found after installation:

  1. Close and reopen your terminal
  2. Check if the installation completed successfully
  3. Try running the install script again

Authentication Issues

If you cannot authenticate:

  1. Verify your Claude subscription is active at claude.ai
  2. Clear any cached credentials and try again
  3. Check your internet connection

Running claude doctor

The claude doctor command helps diagnose issues:

claude doctor

This checks:

  • Installation type (native vs npm)
  • Version information
  • Authentication status
  • System compatibility

Windows-Specific Issues

If you encounter issues on native Windows:

  1. Ensure you are using PowerShell (not Command Prompt) for the install script
  2. Try running PowerShell as Administrator
  3. Consider using WSL 2 for sandboxing support

Next Steps

Frequently Asked Questions

Find answers to common questions

No, the recommended native installer method does not require Node.js. Only the deprecated npm method requires Node.js 18+.

Need Professional IT & Security Help?

Our team of experts is ready to help protect and optimize your technology infrastructure.