Installation

15 min beginner

What You'll Accomplish

  • Install Claude Code on your machine
  • Authenticate with your Anthropic account
  • Verify the installation works correctly
  • Understand the basic configuration options

Before You Begin

You'll need one of the following:

  • An Anthropic API key (from console.anthropic.com)
  • A Claude Pro or Claude Max subscription

Make sure you have Node.js 18+ installed. Check with:

node --version

If you don't have Node.js, install it from nodejs.org or use a version manager like nvm.


Step 1: Install Claude Code

Open your terminal and run:

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

If you encounter permission errors, use:

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

First, ensure you have WSL (Windows Subsystem for Linux) installed:

wsl --install

Then within your WSL terminal:

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

Note: Claude Code runs natively on macOS and Linux. On Windows, WSL is required for the best experience.


Step 2: Authenticate

Run Claude Code for the first time:

claude

You'll be prompted to authenticate. Choose your method:

  1. Anthropic API key — Paste your key from console.anthropic.com
  2. Claude Pro/Max — Follow the OAuth flow in your browser
Welcome to Claude Code! Let's get you set up.

? How would you like to authenticate?
❯ Anthropic API key
  Claude Pro/Max subscription
TIP
Tip
If you're using an API key, set it as an environment variable for convenience: export ANTHROPIC_API_KEY=your-key-here. Add this to your ~/.zshrc or ~/.bashrc to persist it.

Step 3: Verify Installation

Test that everything works:

claude --version

You should see the version number. Then try a quick conversation:

claude "What's 2 + 2?"

If you get a response, you're good to go.

WARNING
Watch Out
If you see command not found: claude, your npm global bin path may not be in your PATH. Run npm config get prefix and ensure [prefix]/bin is in your PATH variable.

Step 4: Basic Configuration (Optional)

Claude Code stores settings in ~/.claude/. You can configure:

Model selection:

claude config set model claude-sonnet-4-20250514

Default behavior:

claude config set autoApprove edit

You don't need to configure anything to get started — the defaults work well for beginners.


Key Takeaways

  • Claude Code installs via npm as a global package
  • Authentication can use either an API key or a Claude subscription
  • The claude command is your entry point for everything
  • Configuration is optional but available in ~/.claude/

Next up: Lesson 1 — Your First Conversation where we'll have our first real interaction with Claude Code.