Beginner 10 min

Install and set up Claude Code: the complete guide

Step-by-step guide to install Claude Code, Anthropic's AI development tool. From installation to your first session in 10 minutes.

installation beginner setup

What exactly is Claude Code?

Claude Code is Anthropic’s official CLI tool for AI-assisted development. Unlike an editor extension like Copilot or Cursor, Claude Code runs directly in your terminal. It reads your codebase, edits your files, executes commands and can chain complex actions autonomously.

The key term: agentic. You describe what you want to accomplish, Claude Code plans the steps and executes them. This is not autocomplete - it is a development agent.

Some numbers for perspective: over 65,000 stars on GitHub, millions of active developers, and adoption that has been exploding since early 2026.

Prerequisites

Before starting, make sure you have:

  • Node.js 18 or higher - check with node --version
  • npm - included with Node.js, check with npm --version
  • An Anthropic account with an API key, or a Claude Max subscription (which includes Claude Code access)
  • A terminal - native terminal on macOS/Linux, Git Bash or WSL on Windows
  • Git - strongly recommended (Claude Code works best inside a Git repository)

If Node.js is not installed, grab it from nodejs.org or via a version manager like nvm:

# Install nvm (macOS/Linux)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Install Node.js 20 LTS
nvm install 20
nvm use 20

Installation

One command is all it takes:

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

The -g flag installs Claude Code globally, making it accessible from any directory.

Verify the installation went smoothly:

claude --version

You should see the version number. If you get a “command not found” error, make sure the npm global directory is in your PATH.

First session

Navigate to an existing project (ideally a Git repository) and launch Claude Code:

cd my-project
claude

On first launch, Claude Code asks you to authenticate. Two options:

  1. Anthropic API key - if you have an API account with credits
  2. Claude Max - connect via your Anthropic subscription (OAuth)

Follow the on-screen instructions. Once logged in, you land on the interactive Claude Code prompt.

First test

Simply type a question about your project:

> Explain the structure of this project

Claude Code will scan your files, understand the directory tree and give you a clear summary. This is the best way to verify everything is working.

Essential commands

Claude Code uses /-prefixed commands for system actions:

CommandDescription
/helpShows all available commands
/clearClears the current conversation context
/compactCompresses context to save tokens
/statusShows session state (model, tokens used)
/initGenerates a CLAUDE.md file for your project
/costShows the session’s token consumption

The /compact command is particularly useful during long sessions. It summarizes the conversation to free up space in the context window without losing the thread.

Key concepts to understand

Codebase reading

When you ask a question or request a change, Claude Code can read any file in your project. It does not load everything into memory at once: it explores relevant files progressively, based on your request.

This is why a well-structured project with explicit file names yields better results.

Permission system

Claude Code asks for your approval before executing certain actions:

  • Reading files - generally allowed by default
  • Writing files - asks for confirmation
  • Running commands - asks for confirmation (especially potentially destructive commands)

You can respond:

  • y (yes) - allow this action
  • n (no) - deny
  • a (always) - always allow this type of action for this session

This system protects your project. Claude Code will never delete a file or run git push --force without your explicit consent.

The CLAUDE.md file

This is the instruction file that Claude Code reads at the start of each session. It contains your project context, conventions, and commands to use. Generate one with /init and customize it afterward.

We have a dedicated guide on CLAUDE.md best practices - that is the recommended next step.

Tips for getting started

Always work inside a Git repository. Claude Code uses Git to track changes. Without Git, you lose the ability to easily revert if a modification does not suit you.

# If your project is not a Git repo yet
git init
git add -A
git commit -m "initial commit"

Start with simple questions. Before asking for a full refactor, ask questions about your code: “Explain this function”, “Find potential bugs in this file”, “What tests are missing?”. You will quickly understand how Claude Code reasons.

Use /init right away. The generated CLAUDE.md file is a good starting point. Edit it to add your specific conventions.

Be precise in your requests. “Fix the bug” is vague. “The login form does not validate emails, add client-side validation with an error message” is actionable.

Review changes before accepting them. Claude Code shows a diff before writing to your files. Take the time to read it, especially early on.

Commit often. After each validated change, make a commit. If Claude Code goes in the wrong direction, a simple git checkout . brings you back to the previous state.

Troubleshooting common issues

”command not found” after installation

Your PATH does not include the npm global directory. Find it with:

npm config get prefix

Add the bin subdirectory to your PATH in .bashrc or .zshrc:

export PATH="$(npm config get prefix)/bin:$PATH"

Authentication failure

Verify your API key is valid at console.anthropic.com. If using Claude Max, make sure your subscription is active and includes Claude Code access.

Claude Code does not understand my project

The problem usually comes from a missing or too vague CLAUDE.md. Run /init, then enrich the generated file with your stack context, conventions and project structure.

What next?

You have Claude Code installed and working. The next step is configuring your CLAUDE.md file to get the most out of the tool. Check out our guide on CLAUDE.md best practices to structure your project instructions.

Some ideas for your next session:

  • Ask Claude Code to write tests for an existing module
  • Have it refactor a file you find too complex
  • Use it to document an obscure part of your code
  • Explore an open source project you are not familiar with by asking it questions