Claude Code installs as a global npm package and authenticates via your Anthropic account. The full setup — from a clean machine to a working first prompt — takes about 10 minutes. This lesson covers both authentication paths, the platform notes worth knowing, and the three things that trip up most first-time installs.
Prerequisites
You need Node.js 18 or newer. Check what you have:
node --versionIf you see v18.x or higher, you're ready. If not, install the LTS release from nodejs.org. The npm package manager comes with Node, so no separate install is needed.
You also need an Anthropic account — either a Claude.ai subscription (Pro, Team, or Enterprise) or direct API access. The authentication path differs slightly between them.
Installing
npm install -g @anthropic-ai/claude-codeVerify it installed correctly:
claude --versionOn macOS and Linux this works immediately. On Windows, native support is improving but WSL (Windows Subsystem for Linux) gives a more reliable experience for terminal-heavy workflows.
Authenticating
The first time you run claude, it opens a browser for OAuth login:
claudeThis launches an OAuth flow against Claude.ai. Log in with your Anthropic account, approve the access, and the token is stored locally. You will not need to do this again on the same machine.
If you prefer API key access (pay-per-token, no subscription required), set the environment variable before starting:
export ANTHROPIC_API_KEY=sk-ant-your-key-here
claudeAvoid passing the key as a CLI flag — it ends up in your shell history.
Choosing an authentication plan
For most QA engineers working alone or on small teams, a Claude Pro subscription via OAuth is the path of least friction. Token costs for typical test-writing sessions are low — generating and refining 10–15 tests rarely costs more than a few cents per session at API rates.
For teams, Claude Team or Enterprise plans provide shared billing and usage controls. Claude Enterprise adds SSO and audit logs for organisations with stricter compliance requirements.
Setting up your first project
cd my-test-project
claudeClaude Code starts in that directory and can immediately read all the files it contains. On first run inside a new project it may offer to create a CLAUDE.md — accept this or decline, you can add it later. Lesson 4 covers what to put in it.
Keeping Claude Code up to date
npm update -g @anthropic-ai/claude-codeClaude Code releases frequently. Bug fixes, new features, and model updates ship as npm releases. Running the update command before a big session keeps you on the actively maintained release line.
Step 1 of 6
Check Node.js version
Run `node --version`. You need v18 or higher. Install the LTS release from nodejs.org if you're behind.
Troubleshooting common failures
claude: command not foundafter install. The global npm bin directory is not on yourPATH. Runnpm bin -gto find the directory and add it to your shell profile.- Authentication loop in browser. Usually a cookie or popup blocker issue. Try in an incognito window or a different browser.
- Commands run but always ask for approval. This is the default — expected behaviour. Lesson 4 covers how to configure permissions so trusted commands run without asking.
⚠️ Common Mistakes
- Running on an outdated Node version. Node 16 and below fail silently or produce confusing errors. Always confirm
node --versionbefore install. - Passing the API key as a CLI flag.
claude --api-key sk-ant-...puts the key in your shell history. Use the environment variable approach or OAuth instead. - Running
claudefrom the wrong directory. Claude Code's context is the directory you started in. Launching it from your home folder means it cannot see your test project. Alwayscdto the project first.
🎯 Practice Task
Install Claude Code and complete a smoke test. 10–15 minutes.
- Confirm
node --versionis 18 or higher. - Run
npm install -g @anthropic-ai/claude-codeand thenclaude --version. - Authenticate via OAuth (
claudein the terminal → browser → approve). - Navigate to any project directory — even a side project works.
- Start a session and type:
What files are in this project? Give me a one-sentence summary. - Confirm Claude Code reads the directory and responds based on what it actually finds.
The next lesson turns this working install into a productive first test-generation session.