Back to all articles
9 MIN READ

Getting Started with Claude Code: Installation & Setup Guide

By Learnia Team

Getting Started with Claude Code: Installation & Setup Guide

This article is written in English. Our training modules are available in French.

Ready to experience AI-powered agentic coding? This step-by-step guide will have you running Claude Code in under 5 minutes, regardless of your operating system.


Prerequisites

Before installing Claude Code, ensure you have:

Required

  • Claude Subscription: Pro ($20/mo), Max ($100/mo), Teams, or Enterprise
    • Or a Claude Console account with API credits
  • Operating System: macOS, Linux, Windows, or WSL (Windows Subsystem for Linux)

Optional but Recommended

  • Node.js 18+: Required only if installing via NPM
  • Git: For version control features
  • A code editor: VS Code, JetBrains, Vim, etc. (Claude Code works with any editor)

Installation Methods

Claude Code offers four installation methods. Choose the one that fits your environment:

MethodBest ForPlatforms
Native InstallMost usersmacOS, Linux, Windows
HomebrewmacOS users who prefer brewmacOS
NPMNode.js developersAll platforms
ManualEnterprises, custom setupsAll platforms

Method 1: Native Install (Recommended)

The native installer is the easiest and most reliable method.

macOS and Linux

Open your terminal and run:

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

This script:

  1. Downloads the latest Claude Code binary
  2. Installs it to your system PATH
  3. Sets up auto-updates

Windows PowerShell

Open PowerShell as Administrator and run:

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

Windows Command Prompt (CMD)

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Verify Installation

After installation, verify Claude Code is working:

claude --version

You should see output like:

Claude Code v1.0.45

Method 2: Homebrew (macOS)

If you use Homebrew on macOS:

brew install --cask claude-code

Update later with:

brew upgrade claude-code

Method 3: NPM Installation

For Node.js developers who prefer NPM:

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

Important: NPM installation requires Node.js 18 or later.

Update later with:

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

Method 4: Manual Installation

For enterprises or custom setups, download binaries directly from:


First-Time Authentication

After installation, you need to authenticate with your Anthropic account.

Step 1: Navigate to a Project

cd your-project-directory

Step 2: Start Claude Code

claude

Step 3: Authenticate

On first launch, Claude Code will:

  1. Open your default browser
  2. Redirect to the Anthropic login page
  3. Ask you to authorize Claude Code

Complete the authentication in your browser, then return to your terminal.

Step 4: Confirm Authentication

Once authenticated, you'll see:

✓ Authenticated as your-email@example.com
✓ Using Claude Pro subscription

Welcome to Claude Code! How can I help you today?
>

Authentication Options

Claude Subscription (Default)

If you have a Claude Pro, Max, Teams, or Enterprise subscription, authentication happens automatically through OAuth.

API Key (Console Users)

If you're using Claude Console with API credits:

# Set your API key as an environment variable
export ANTHROPIC_API_KEY="sk-ant-..."

# Start Claude Code
claude

For persistent configuration, add to your shell profile (

~/.bashrc
,
~/.zshrc
, etc.):

export ANTHROPIC_API_KEY="sk-ant-your-key-here"

AWS Bedrock

For enterprise users with AWS Bedrock:

export ANTHROPIC_MODEL="us.anthropic.claude-sonnet-4-20250514-v1:0"
export AWS_REGION="us-east-1"
# Ensure AWS credentials are configured

claude

Google Vertex AI

For Google Cloud users:

export ANTHROPIC_MODEL="claude-sonnet-4@20250514"
export CLOUD_ML_REGION="us-east5"
export ANTHROPIC_VERTEX_PROJECT_ID="your-project-id"

claude

Your First Claude Code Session

Let's walk through your first interaction with Claude Code.

Step 1: Start in Your Project

cd my-project
claude

Step 2: Initialize Project Memory

Create a

CLAUDE.md
file to help Claude understand your project:

> /init

Claude Code will:

  1. Scan your project structure
  2. Identify languages, frameworks, and patterns
  3. Generate a
    CLAUDE.md
    file with project context

Step 3: Ask a Question

> What does this project do? Explain the main architecture.

Claude will analyze your codebase and provide an overview.

Step 4: Make Your First Edit

> Add a health check endpoint to the API at /health that returns { status: "ok" }

Claude will:

  1. Find your API routes
  2. Create the endpoint following your existing patterns
  3. Show you what changed

Step 5: Review Changes

> /review

Claude reviews recent changes and provides feedback.

Step 6: Check Usage

> /cost

See your token usage for the session.

Step 7: Exit

> /exit

Or press

Ctrl+C
twice.


Essential Configuration

CLI Flags

Claude Code supports various flags for customization:

# Use a specific model
claude --model claude-opus-4-5-20251101

# Set maximum conversation turns
claude --max-turns 20

# Start with a specific prompt
claude -p "Review the changes in the last commit"

# Run in print mode (non-interactive)
claude --print "Explain the main.py file"

Common Flags Reference

FlagShortDescription
--model
-m
Specify Claude model (sonnet, opus, haiku)
--max-turns
Maximum conversation turns
--print
-p
Non-interactive mode, prints response and exits
--system-prompt
Custom system prompt
--resume
-r
Resume previous session
--continue
-c
Continue most recent session
--debug
Enable debug output
--version
-v
Show version
--help
-h
Show help

Settings File

Create

~/.claude/settings.json
for persistent configuration:

{
  "model": "claude-sonnet-4-20250514",
  "permissions": {
    "allow": ["Read", "Glob", "Grep"],
    "deny": ["Bash(rm:*)"]
  },
  "theme": "dark"
}

See Claude Code Permissions: Deny, Allow & Ask Modes for detailed permission configuration.


IDE Integration

Claude Code works with any editor, but offers deeper integration with some:

VS Code

Install the Claude Code extension:

  1. Open VS Code
  2. Go to Extensions (
    Ctrl+Shift+X
    )
  3. Search "Claude Code"
  4. Install the official Anthropic extension

Or via CLI:

code --install-extension anthropic.claude-code

Features:

  • Inline Claude Code panel
  • Status bar integration
  • Keyboard shortcuts

JetBrains IDEs

Install from JetBrains Marketplace:

  1. Open Settings → Plugins
  2. Search "Claude Code"
  3. Install and restart

Features:

  • Tool window integration
  • Context-aware suggestions

Terminal Editors (Vim, Neovim, Emacs)

Claude Code runs in a separate terminal pane. Use tmux or split terminals:

# Terminal 1: Your editor
nvim src/main.py

# Terminal 2: Claude Code
claude

Status Line Setup

For terminals that support it:

> /statusline

This adds Claude Code status to your terminal prompt.


Project Initialization

For the best experience, initialize each project with Claude Code:

Automatic Initialization

> /init

This creates a

CLAUDE.md
file tailored to your project.

Manual CLAUDE.md

Create

.claude/CLAUDE.md
or
CLAUDE.md
at your project root:

# Project: My Awesome App

## Overview
A Next.js e-commerce platform with TypeScript and Prisma.

## Tech Stack
- Next.js 14 with App Router
- TypeScript (strict mode)
- Prisma with PostgreSQL
- Tailwind CSS

## Conventions
- Use functional components with hooks
- API routes in /app/api/
- All database changes require migrations
- Tests in __tests__ folders alongside code

## Important Notes
- Never modify /lib/payment/ directly (handled by external team)
- Environment variables in .env.local (not committed)

Learn more in CLAUDE.md: Your Project's AI Memory File Explained.


Troubleshooting

"Command not found: claude"

macOS/Linux: Add to PATH

export PATH="$HOME/.claude/bin:$PATH"

Add this line to your

~/.bashrc
or
~/.zshrc
.

Windows: Restart PowerShell or add to system PATH.

"Authentication failed"

  1. Clear existing credentials:

    claude /logout
    
  2. Re-authenticate:

    claude /login
    

"Connection refused" or network errors

Check your internet connection and firewall settings. Claude Code needs access to:

  • api.anthropic.com
  • claude.ai

Slow performance on large projects

For very large codebases:

  1. Use

    .claudeignore
    to exclude unnecessary files:

    node_modules/
    .git/
    dist/
    build/
    *.log
    
  2. Start with specific context:

    claude --context "src/api/"
    

Windows-specific issues

NPX servers failing: Use the

cmd /c
wrapper:

claude mcp add --transport stdio my-server -- cmd /c npx -y some-package

Check installation health

> /doctor

This runs diagnostics and reports any issues.


Updating Claude Code

Claude Code updates automatically, but you can force an update:

Native Install

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

Homebrew

brew upgrade claude-code

NPM

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

Check for Updates

> /release-notes

Uninstalling Claude Code

If you need to uninstall:

Native Install (macOS/Linux)

rm -rf ~/.claude
rm $(which claude)

Homebrew

brew uninstall claude-code

NPM

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

Windows

Use "Add or Remove Programs" or:

Remove-Item -Recurse -Force "$env:USERPROFILE\.claude"

Next Steps

Now that Claude Code is installed, here's what to explore next:

  1. Master Slash Commands: Learn all built-in commands → Claude Code Slash Commands: Complete Reference Guide

  2. Configure Project Memory: Set up CLAUDE.md for your projects → CLAUDE.md: Your Project's AI Memory File Explained

  3. Understand Permissions: Configure security settings → Claude Code Permissions: Deny, Allow & Ask Modes

  4. Connect External Tools: Set up MCP integrations → Model Context Protocol (MCP) for Claude Code: Complete Guide


Key Takeaways

  1. Multiple installation methods: Native install is recommended for most users, with Homebrew, NPM, and manual options available.

  2. Authentication is automatic for Claude subscribers, or use API keys for Console users.

  3. Run

    /init
    on new projects to create a CLAUDE.md file for project memory.

  4. CLI flags customize behavior: Use

    --model
    ,
    --max-turns
    , and
    --print
    for different workflows.

  5. IDE integration enhances the experience but isn't required—Claude Code works with any editor from the terminal.


Ready to Build Effective Prompts?

You've installed Claude Code—now it's time to master the art of communicating with it effectively.

In our Module 1 — LLM Anatomy & Prompt Structure, you'll learn:

  • How large language models process your prompts
  • The anatomy of effective prompts for coding tasks
  • Token management and context window optimization
  • Techniques for consistent, high-quality outputs

Explore Module 1: LLM Anatomy & Prompt Structure

GO DEEPER

Module 1 — LLM Anatomy & Prompt Structure

Understand how LLMs work and construct clear, reusable prompts.