Module 2: Getting Started with Claude CodeLesson 2 of 6
0%
Lesson 2ยท5 min

Installing Claude Code

Get Claude Code running on your machine

Installing Claude Code

Let's get Claude Code installed. The process takes about 5 minutes.

Step 1: Install Node.js

Claude Code requires Node.js. Check if you have it:

Terminal
$ node --version
v20.10.0
โ–Œ

If you see a version number (v18 or higher), skip to Step 2!

Installing Node.js

macOS (recommended):

Terminal
# Install Homebrew first (if not installed)
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js
$ brew install node
# Verify
$ node --version
โ–Œ

Windows:

  1. Download from nodejs.org
  2. Run the installer
  3. Restart your terminal

Linux:

Terminal
$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
$ sudo apt-get install -y nodejs
โ–Œ

Step 2: Install Claude Code

Terminal
$ npm install -g @anthropic-ai/claude-code
โ–Œ

Tip

The -g flag installs it globally, so you can use it from any folder.

If you get permission errors:

Terminal
# macOS/Linux
$ sudo npm install -g @anthropic-ai/claude-code
# Or fix npm permissions (better long-term)
$ mkdir ~/.npm-global
$ npm config set prefix '~/.npm-global'
# Add to your shell config: export PATH=~/.npm-global/bin:$PATH
โ–Œ

Step 3: Authenticate

Terminal
$ claude auth
โ–Œ

This opens a browser window. Sign in with your Anthropic account (create one if needed).

Warning

Claude Code uses API credits. New accounts get some free credits. After that, it's pay-per-use (very affordable for learning).

Step 4: Verify Installation

Terminal
$ claude --version
Claude Code v1.x.x
$ claude --help
Claude Code - AI coding assistant
Commands:
claude [prompt] Start session or run prompt
claude auth Authenticate with Anthropic
...
โ–Œ

Quick Test

Terminal
$ mkdir test-project
$ cd test-project
$ claude "Create a hello world HTML file"
โ–Œ

If Claude creates an HTML file, you're all set! ๐ŸŽ‰

Aussie Note

Having trouble? The Anthropic Discord is friendly and responsive. Just search "Claude Code install [your issue]". ๐Ÿฆ˜

Troubleshooting

"command not found: claude"

  • Make sure npm global bin is in your PATH
  • Try opening a new terminal window

Authentication fails

  • Clear cookies and try again
  • Check your internet connection

API errors

  • Verify your account at console.anthropic.com
  • Check you have API credits

Key Takeaways

  • Claude Code needs Node.js v18+
  • Install with npm install -g @anthropic-ai/claude-code
  • Authenticate with claude auth
  • Test with a simple prompt to verify it works