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:
| Method | Best For | Platforms |
|---|---|---|
| Native Install | Most users | macOS, Linux, Windows |
| Homebrew | macOS users who prefer brew | macOS |
| NPM | Node.js developers | All platforms |
| Manual | Enterprises, custom setups | All 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:
- →Downloads the latest Claude Code binary
- →Installs it to your system PATH
- →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:
- →Open your default browser
- →Redirect to the Anthropic login page
- →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:
- →Scan your project structure
- →Identify languages, frameworks, and patterns
- →Generate a
file with project contextCLAUDE.md
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:
- →Find your API routes
- →Create the endpoint following your existing patterns
- →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
| Flag | Short | Description |
|---|---|---|
| | Specify Claude model (sonnet, opus, haiku) |
| Maximum conversation turns | |
| | Non-interactive mode, prints response and exits |
| Custom system prompt | |
| | Resume previous session |
| | Continue most recent session |
| Enable debug output | |
| | Show version |
| | 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:
- →Open VS Code
- →Go to Extensions (
)Ctrl+Shift+X - →Search "Claude Code"
- →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:
- →Open Settings → Plugins
- →Search "Claude Code"
- →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"
- →
Clear existing credentials:
claude /logout - →
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:
- →
Use
to exclude unnecessary files:.claudeignorenode_modules/ .git/ dist/ build/ *.log - →
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:
- →
Master Slash Commands: Learn all built-in commands → Claude Code Slash Commands: Complete Reference Guide
- →
Configure Project Memory: Set up CLAUDE.md for your projects → CLAUDE.md: Your Project's AI Memory File Explained
- →
Understand Permissions: Configure security settings → Claude Code Permissions: Deny, Allow & Ask Modes
- →
Connect External Tools: Set up MCP integrations → Model Context Protocol (MCP) for Claude Code: Complete Guide
Key Takeaways
- →
Multiple installation methods: Native install is recommended for most users, with Homebrew, NPM, and manual options available.
- →
Authentication is automatic for Claude subscribers, or use API keys for Console users.
- →
Run
on new projects to create a CLAUDE.md file for project memory./init - →
CLI flags customize behavior: Use
,--model
, and--max-turns
for different workflows.--print - →
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
Module 1 — LLM Anatomy & Prompt Structure
Understand how LLMs work and construct clear, reusable prompts.