Installing Claude Code and Choosing Where It Runs
On this page8 items
In 10 seconds
Install it, then type
claudein your project directory. That’s all.
The first thing to do is one round trip in a repository you don’t mind breaking.
This page is just the entrance. Which environment to use is covered in No. 36, so here we take the shortest path to getting it running.
Installation#
The officially recommended method is the native install.
macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bashWindows PowerShell
irm https://claude.ai/install.ps1 | iexYou can also install it with Homebrew (brew install --cask claude-code) or WinGet (winget install Anthropic.ClaudeCode). The native install updates itself automatically, but Homebrew and WinGet installs must be updated manually. This is where the methods differ, so keep it in mind.
On Windows, installing Git for Windows lets Claude Code use the Bash tool. Without it, PowerShell is used.
If you use the desktop app, you don’t need to install the CLI separately. It’s included in the app.
Your first session#
cd your-project
claudeThe first time, you’ll be asked to log in. If you’ve set ANTHROPIC_API_KEY, you only need to approve that key.
Start with a repository you don’t mind breaking. It’s the same reason given for Cowork in No. 27. Claude Code treats the directory you launched it in, and everything below it, as its working scope.
Three things to do first#
1. Ask what’s there.
Please explain the structure of this repository. Don't change anything yet.This only reads, so it’s safe. You’ll see how Claude Code understands this project.
2. Run /init.
It drafts a CLAUDE.md for you. It analyzes the codebase and writes out build commands, test procedures, and conventions. If a CLAUDE.md already exists, it suggests improvements instead of overwriting it. The contents are covered in No. 38.
3. Ask for one small change.
Please fix the typo in the README. Before fixing it, show me where you'll change it.Adding “show me before you fix it” is the habit carried over from Chapter 3.
Things worth knowing so you don’t get lost#
Only the ones you’re guaranteed to meet in your first few days.
| What it does | |
|---|---|
/init | Drafts a CLAUDE.md |
/context | Shows what’s currently loaded |
/clear | Wipes the conversation clean |
/rewind | Goes back to an earlier state (No. 39) |
/usage | Shows usage (No. 44) |
Esc | Stops whatever is running right now |
Shift+Tab | Switches permission modes (No. 39) |
Get in the habit of pressing Esc early. If it starts heading the wrong way, stopping it is faster than watching it all the way to the end.
Environment variables and settings#
Detailed settings can wait. There’s just one thing worth deciding up front if you use it as a team.
.claude/settings.json can be committed to the repository and shared, while .claude/settings.local.json is yours alone. Add the latter to .gitignore.
Settings are covered in detail from No. 39 onward, in the order you’ll need them.
Try it: a read-only round trip (5 minutes)
Launch
claudein a repository on your machine.Prompt
“`
Please tell me the following about this project. Don’t change anything yet.・What the project does
・How to build and test it
・Three things a newcomer is likely to trip over
“`Expected result: You get answers to all three. The third may surface something you hadn’t noticed yourself.
If it doesn’t work: If the answers are off the mark, that’s exactly what you should write in CLAUDE.md. Move on to No. 38.
Common pitfalls#
Asking for a big change right away. Go in order: read only → small fix → big fix. Same as Chapter 4.
Forgetting to update. Homebrew and WinGet don’t update automatically. With the native install you don’t have to think about it, so if in doubt, that’s the one I’d recommend.
Launching it in your home directory. The working scope becomes enormous. Always launch it in a project directory.
Summary#
- Install it, then run
claudein your project directory - Start with a read-only round trip in a repository you don’t mind breaking
- Use
/initto draft aCLAUDE.md - Get in the habit of pressing
Escearly