Skip to main content
This lesson covers the prerequisites and the quick start for using Claude Code — the developer CLI that helps you generate, inspect, and run code in your project. Claude Code is available as an npm package (@anthropic-ai/claude-code). If you already use npm, installation is straightforward; otherwise, you only need a recent Node.js runtime (Node 18+) and an active Claude or Anthropic Console account.
Ensure Node.js 18 or newer is installed and that you have an active Claude (or Anthropic Console) account before continuing.

What you’ll need

Install Node.js

On macOS (Homebrew):
Typical output when Node is already installed:
On Debian/Ubuntu, the distribution repos may contain older Node versions. Use NodeSource for Node 18:
Or use nvm to manage multiple Node versions:
On Windows, download and run the installer from the official site: https://nodejs.org/. The important requirement is Node.js 18+.

Install Claude Code (global)

Install the CLI globally so you can run claude from any project folder:
Example output after installation:
Note: the -g flag installs the package globally. Without -g the package installs into the current project only. On some systems you may need sudo for global installs or to configure npm to use a user-writable global directory.
If you see permission errors installing globally, avoid using sudo as a first choice — instead configure npm to use a user-owned global directory or use a version manager (nvm) to install Node and npm without elevated privileges.

First run and authentication

Start the CLI:
On first run the CLI will prompt for initial preferences (for example, text/ANSI color settings) and then guide you through authentication. The CLI supports two login flows:
  • Sign in with your Claude subscription account (Pro, Max, etc.).
  • Sign in via Anthropic Console (API / key-based billing).
The CLI attempts to open a browser for OAuth. If a browser cannot be opened (for example, when using WSL, SSH, or a headless environment), the CLI prints a URL that you can copy into any browser to complete sign-in. Example output when the CLI prints an authorization URL (wraps across lines):
After authorizing in the browser you’ll receive a short code to paste back into the CLI. A successful login looks like:
A dark-themed browser window showing an OAuth authorization prompt where "Claude Code" is requesting to connect to a Claude chat account, with prominent "Authorize" and "Decline" buttons. The dialog lists the account permissions against a black background.
The browser prompt asks you to allow Claude Code to access your account (profile info, usage contribution, etc.). Authorize to proceed.

Quick demo — generate a Python script that reads a CSV

This quick example shows Claude Code generating a small Python script to read members.csv and print first and last names. I created a members.csv file using Mockaroo and placed it into a project folder.
A screenshot of the Mockaroo web interface showing a mock data schema with fields like id, first_name, last_name, email, gender, and ip_address. The page includes options to generate, preview, and export the dataset (CSV format) and other schema settings.
At the Claude Code prompt I asked it to create a Python file that reads members.csv and displays first and last names. Claude Code inspected the current directory and generated this robust script using Python’s csv module. Generated file: read_members.py
Why this script is practical:
  • Uses csv.DictReader to work with named columns.
  • Handles header capitalization differences (first_name vs First Name).
  • Catches FileNotFoundError and general exceptions for clearer error messages.

Run the generated script

From the same project folder you can run the script directly. Optionally create and activate a virtual environment first:
Then execute:
Example output (first and last names from the CSV):
Keep Claude Code running in any terminal (for example, the integrated terminal in VS Code) and continue issuing requests, generating or editing files, and iterating interactively.

Troubleshooting tips

  • If claude is not found after global install, ensure your npm global binaries directory is on your PATH. For many systems that directory is ~/.npm-global/bin or the location printed by npm bin -g.
  • If OAuth browser flow doesn’t open, copy the printed URL into a browser and follow the instructions. Paste the verification code back into the CLI when prompted.
  • Use nvm to avoid permission issues and to switch Node versions without sudo.

Summary and next steps

  • Install Node.js 18+ and verify npm is available.
  • Install Claude Code globally: npm install -g @anthropic-ai/claude-code.
  • Authenticate the CLI via browser OAuth or Anthropic Console.
  • Use Claude Code to generate code (like a Python CSV reader), inspect, and run it — then iterate.
Further lessons will cover advanced workflows, integrations (editors and CI), and project-specific customization.

Watch Video