Claude Code, part 1: Install and first session
Series Getting started with Claude Code Part 1 of 5
This is part 1 of a five-part guide that goes from a fresh install to building your own MCP servers and a RAG pipeline. Everything here was checked against the official docs and Claude Code 2.1.302 (October 2026). Claude Code ships updates almost daily, so when something differs, the official docs win.
What Claude Code is
Claude Code is an agentic coding assistant that runs in your terminal. Unlike an autocomplete plugin, it works on your whole project: it reads files, runs commands, edits code and checks its own work.
Every task runs through the same loop:
your prompt
│
▼
gather context ──▶ take action ──▶ verify results ──┐
▲ │
└────────────── repeat until done ◀─────────────┘
(you can interrupt and steer at any point)
It does that with tools:
| Category | What Claude can do |
|---|---|
| File operations | Read, edit, create, rename and reorganise files |
| Search | Find files by pattern, search contents with regex |
| Execution | Run shell commands, tests, builds, git |
| Web | Search the web and fetch docs or error messages |
| Code intelligence | See type errors, jump to definitions (with code-intelligence plugins) |
When you run claude in a folder, it can see that project, your terminal, your git state, your CLAUDE.md instructions (part 2) and any extensions you’ve added (parts 3–4).
Requirements
- OS: macOS 13+, Windows 10 1809+ / Server 2019+, Ubuntu 20.04+, Debian 10+, or Alpine 3.19+
- Hardware: 4 GB+ RAM, x64 or ARM64
- Account: a Claude Pro, Max, Team or Enterprise plan, or a Claude Console (API) account. The free claude.ai plan doesn’t include Claude Code. Amazon Bedrock, Google Cloud and Microsoft Foundry also work.
Install
Native installer (recommended)
Native installs update themselves in the background.
# 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
On native Windows, install Git for Windows as well, so Claude Code can use Bash. Without it, Claude Code falls back to PowerShell. WSL doesn’t need it.
Package managers
# Homebrew (does not auto-update)
brew install --cask claude-code # stable channel, ~1 week behind
brew install --cask claude-code@latest # every release as it ships
# WinGet (does not auto-update)
winget install Anthropic.ClaudeCode
There are also signed apt, dnf and apk repositories for Debian, Fedora/RHEL and Alpine. See Advanced setup.
npm
npm install -g @anthropic-ai/claude-code # needs Node.js 22+
Never use sudo npm install -g. If you hit permission errors, fix your npm prefix instead.
Verify
Open a new terminal, then run:
claude --version # e.g. 2.1.302 (Claude Code)
claude doctor # install health, settings validation, warnings with fixes
If you get command not found, the install folder (~/.local/bin on macOS and Linux) isn’t on your PATH yet. Open a new terminal or add it to your shell profile.
Sign in
cd ~/projects/my-app
claude
The first run opens your browser to sign in. Credentials are stored, so you only do this once. Inside a session, /login switches accounts.
Using an API key instead: if ANTHROPIC_API_KEY is set, Claude Code asks whether to use it and skips the browser login. Usage is then billed to your Console account rather than your subscription.
Your first session
Start in a real project and ask before you change anything:
what does this project do?
where is the main entry point?
explain the folder structure
You don’t need to point it at files; it reads what it needs. Then make a small change:
add input validation to the signup form, then run the tests
Claude finds the right files, shows the edits and runs the tests. Git works conversationally too:
what files have I changed?
commit my changes with a descriptive message
create a branch called feature/validation
Essential commands
From your shell
| Command | What it does |
|---|---|
claude |
Start an interactive session |
claude "fix the build error" |
Start a session with a first prompt |
claude -p "explain this function" |
One-off answer, then exit (scripting, see part 3) |
claude -c |
Continue the most recent conversation in this folder |
claude -r |
Pick a previous conversation to resume |
claude update |
Update now |
Inside a session
| Command / key | What it does |
|---|---|
/help |
List commands |
/ |
Browse every command and skill available |
/clear |
Start a fresh conversation |
/model |
Switch model |
/init |
Generate a CLAUDE.md for the project (part 2) |
Shift+Tab |
Cycle permission modes (part 2) |
Esc |
Stop Claude mid-task |
Esc Esc |
Rewind to an earlier checkpoint |
/exit or Ctrl+D twice |
Quit |
Staying up to date
Native installs auto-update. To prefer a slightly older but steadier build, set the release channel in ~/.claude/settings.json:
{
"autoUpdatesChannel": "stable"
}
Homebrew and WinGet installs update with brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode.
Other places it runs
The same agent runs in the desktop app, VS Code and JetBrains extensions, the browser at claude.ai/code, Slack, and GitHub Actions or GitLab CI. The settings, skills and MCP servers you build in this guide carry over to the local ones.
Next
Part 2 covers the everyday workflow: permission modes, plan mode, checkpoints, managing context, and teaching Claude your project with CLAUDE.md.