Installing Claude Code and Connecting Your First Project
Claude Code is installed once from your terminal, then launched from inside any project directory you want it to work on.
Search across all documentation pages
Claude Code is installed once from your terminal, then launched from inside any project directory you want it to work on.
This page walks through that setup end to end: install, connect to a real project, and run a first request.
Installing Claude Code is a single CLI command, similar to installing any other global developer tool.
Once installed, the CLI has no persistent connection to a project until you launch it from inside that project's directory.
Each session starts fresh in whichever folder you were in when you typed the launch command.
The first session in a new project is a good moment to let Claude Code orient itself before asking for anything complex.
Getting this initial setup right avoids most of the confusion new users run into in their first week.
Quick-reference recipe card - copy-paste ready.
# 1. Install the CLI globally
npm install -g @anthropic-ai/claude-code
# 2. Confirm it installed
claude --version
# 3. Move into the project you want help with
cd ~/projects/my-app
# 4. Launch the interactive session
claudeWhen to reach for this:
# A full first-session walkthrough, from a clean terminal
# Install the CLI (Node.js and npm must already be installed)
npm install -g @anthropic-ai/claude-code
# Verify the install
claude --version
# Navigate into the project you want to connect
cd ~/projects/my-app
# Launch Claude Code in that project
claude
# At the prompt that opens, describe your first task in plain language
> Summarize what this project does and list its main dependenciesWhat this demonstrates:
cd-ing into it before launching.>) where every subsequent request is typed.claude from a directory.| Step | Why it matters |
|---|---|
Confirm claude --version works | Confirms the install and PATH are correct before you rely on it |
cd into the actual project root | Claude Code reads from the current directory, not a path you type later |
| Ask an orientation question first | Confirms it read the project correctly before you hand off real work |
| Pick a starting permission mode | Decide up front whether you want approval prompts on this first session |
# Update to the latest version later on
npm update -g @anthropic-ai/claude-code
# Check where the binary is installed if `claude` is not found
npm root -gcd into the actual project root before running claude.claude launch as a fresh connection scoped to the current directory.PATH after install can silently make claude resolve to nothing or an old cached version. Fix: run claude --version immediately after installing, before starting real work.npm, so a missing or very old Node.js install will cause the install command to fail outright. Fix: confirm node --version and npm --version work before installing Claude Code.| Alternative | Use When | Don't Use When |
|---|---|---|
Launch with claude and no flags | You want your configured defaults for permission mode | You need a specific permission mode just for this session |
| Launch with an explicit permission flag | You want to be sure of the mode for a one-off session | You already have a project-level default you trust |
| Reinstall from scratch | Your install is broken or badly out of date | A simple npm update -g would fix the same problem faster |
No. The install is global, done once per machine. Connecting to a specific project just means launching claude from inside that project's directory.
Run claude --version right after installing. A version number back confirms both the install and your PATH are correct.
Claude Code treats whatever directory you launched from as the project root, so it will read and reason about the wrong files. Exit, cd into the correct project, and relaunch.
Something low-stakes and orienting, like asking it to summarize the project or list its dependencies. This confirms it read the project correctly before you hand off real work.
Project-level configuration exists for things like permission defaults, but the core connection step is simply launching from the project directory each time; there is no separate registration step.
Yes, but each session is scoped to the directory you launched it from. Working across two projects at once means running two separate sessions, typically in two terminal tabs.
It helps. Deciding up front whether you want ask-every-time or auto-accept for that first session avoids surprises, especially in an unfamiliar or important codebase.
npm update -g @anthropic-ai/claude-codeRun claude --version afterward to confirm the update took effect.
This usually means the global npm bin directory is not on your shell's PATH. Run npm root -g to find where global packages install, and confirm the corresponding bin directory is on your PATH.
It depends on how your npm global installs are configured on your machine. If you hit permission errors, that is a sign your npm global directory needs adjusting rather than something specific to Claude Code.
Stack versions: Written against the Claude model lineup current as of ~June 2026 - Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5 (the default), and Claude Haiku 4.5. Model names, pricing, and product features move quickly - verify current specifics at platform.claude.com/docs before relying on them.
Reviewed by Chris St. John·Last updated Jul 18, 2026