Chapter 01 · Section II · 15 min read
Installing and your first session
Twenty minutes of setup and you are talking to a working coding assistant inside your terminal. No IDE plugin needed. Node, an API key, and a shell.
Claude Code is distributed as a Node package. If you have a working Node install and an Anthropic account, you can be in a session in about five minutes. The rest of this section walks you through the steps — install, authenticate, launch, and quit — so nothing surprises you the first time.
Prerequisites
You need three things.
- Node.js 20 or later. If you already have a Node version manager like
fnmornvm, you can use that. If not, install fromnodejs.orgor via your package manager. - An Anthropic API key. Sign up at
console.anthropic.com, add a small amount of credit (or use free trial credit), and create an API key. Keep it somewhere safe. - A terminal. Any modern terminal on macOS, Linux, or WSL on Windows works.
Install
The recommended way is via npm:
npm install -g @anthropic-ai/claude-code
That drops a claude binary on your $PATH. Verify it worked:
claude --version
Authenticate
The first time you run the binary, it will walk you through authentication. Two options:
- Console login (recommended). Opens a browser window; you sign in with the same Anthropic account you use for
console.anthropic.com. The token is saved in a config file in your home directory. - API key. If you cannot open a browser (say, you are on a remote server), you can export
ANTHROPIC_API_KEYin your shell profile instead.
Either way, this is a once-per-machine step.
Your first session
Change into a project directory — any project will do — and run:
claude
You are now in a session. The prompt is a simple text input. Try:
what files are in this repo?
Claude will probably use its Bash or Glob tool to answer. The first time it wants to run a shell command it will ask you for permission; approve it and you will see the output come back into the transcript.
Try one more:
open src/index.ts and summarise what it does
If the file exists, you will get a plain-English summary. If not, Claude will say so — it does not invent files.
Ending a session
Type /exit or hit Ctrl-C twice. Your conversation transcript is saved locally by default; you can review or resume it later. If you set up an IDE integration, sessions can persist across restarts too — but for this course we stick to the plain terminal.
Check your understanding
Quick check
—