Before you start
You'll need three things in place:
- macOS, Linux, WSL, or Windows with PowerShell or CMD
- An active Claude account at claude.ai, or an API key from console.anthropic.com
- A real code project directory to experiment in — not a throwaway folder
Choosing your install method
The native installer is recommended for most users — it auto-updates in the background, so you always have the latest version. Run the line that matches your platform:
# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
# Windows CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Prefer a package manager? Those work too — just remember they do not auto-update, so you'll need to upgrade manually:
# Homebrew (macOS) — upgrade with: brew upgrade claude-code
brew install --cask claude-code
# WinGet (Windows)
winget install Anthropic.ClaudeCode
# Linux package managers: apt, dnf, apk are supported.
# See /en/setup for repository configuration.
Authentication
On first run, Claude Code opens a browser for OAuth login with your claude.ai account. That's all most people need. If you'd rather authenticate with an API key, set it in your environment instead:
export ANTHROPIC_API_KEY="sk-ant-..."
Note: Third-party providers such as Amazon Bedrock and Google Vertex require additional environment variables — we cover those in the advanced production chapters.
Your first session
Move into a real project and launch Claude:
cd your-project-directory
claude
Claude loads CLAUDE.md (if present), your auto memory, and system context, then shows a prompt. Ask it for the lay of the land — this is the "gather context" phase in action:
> What does this codebase do? Give me a high-level overview.
Claude reads your files and explains the project back to you. You've completed the first phase of the agentic loop.
Essential commands
A small set of slash commands and key presses cover almost everything you'll do day to day:
| Command | What it does |
|---|---|
| /help | List all available slash commands |
| /doctor | Diagnose installation issues — your first stop when something's off |
| /model | Switch models mid-session |
| /init | Walk through creating a CLAUDE.md for your project |
| /context | See what's consuming your context window |
| /compact | Manually compact conversation history to free up space |
| Esc | Interrupt Claude mid-action |
| Esc Esc | Rewind to a previous checkpoint |
| Shift+Tab | Cycle through permission modes |
If something goes wrong
/doctorcatches most installation problems automatically.- Using API key auth? Confirm
ANTHROPIC_API_KEYis actually set in your shell. - For platform-specific quirks, see
/en/troubleshoot-install.
Best practice: Read the first 20 lines of every Claude response before interrupting — its visible reasoning often explains exactly what it's about to do.
Common mistakes & best practices
Avoid
- Using Homebrew/WinGet then wondering why you're behind on features (no auto-update)
- Experimenting in an empty throwaway folder — it limits what you can learn
- Hitting Enter before reading Claude's output and missing important context
Do
- Start with a real project, not a toy example
- Use the native installer so you get automatic updates
- Read the first ~20 lines of every response before interrupting
Hands-on exercise
Install Claude Code, navigate to a real project (not a throwaway folder), and complete Quickstart steps 1–8: get a high-level overview, explore a file, make your first edit, run the test suite, and create a git commit — all through natural language.
Claude Code Installation FAQ
How do I install Claude Code?
Use the native installer for your platform: curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux, or WSL, or the PowerShell or CMD command on Windows. The native installer is recommended because it auto-updates in the background.
Can I install Claude Code with Homebrew or WinGet?
Yes. brew install --cask claude-code works on macOS and winget install Anthropic.ClaudeCode works on Windows, and apt, dnf, and apk are supported on Linux. Package-manager installs do not auto-update, so you have to upgrade manually.
Do I need an API key to use Claude Code?
No. Most people authenticate through browser OAuth with a claude.ai account on first run. If you prefer, you can set ANTHROPIC_API_KEY in your environment to authenticate with an Anthropic API key instead.
What commands should I learn first in Claude Code?
Start with /help, /doctor, /init, /context, and /compact, plus the key presses Esc to interrupt, Esc Esc to rewind to a checkpoint, and Shift+Tab to cycle permission modes.
Claude Code won't start — how do I fix it?
Run /doctor first; it catches most installation problems automatically. If you authenticate with an API key, confirm ANTHROPIC_API_KEY is actually set in your shell, and check the troubleshoot-install docs for platform-specific quirks.
Quick summary
- Use the native installer for automatic background updates
- Homebrew and WinGet work but require manual upgrades
- Authenticate via browser OAuth, or set
ANTHROPIC_API_KEY - Learn the core commands early: /help, /doctor, /init, /context, /compact, Esc, Shift+Tab