Skip to content

Installation and Your First Session

Install Claude Code on any OS, authenticate, and complete your first real task. No toy examples.

Installation takes about 30 seconds. The part that actually matters is what happens right after, when you sit there staring at a blank prompt and realize you need to give it something real to do.

Installing Claude Code

Multiple ways to get Claude Code on your machine. The native installer is your best bet because it handles auto-updates in the background. Install once, forget about version management.

macOS, Linux, or 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

Windows users: you need Git for Windows installed first. If you don't have it, grab it from git-scm.com before running the installer.

Package managers work too, if that's your thing:

# Homebrew (macOS/Linux)
brew install --cask claude-code
 
# WinGet (Windows)
winget install Anthropic.ClaudeCode

Fair warning: package managers don't auto-update. You'll need to run brew upgrade claude-code or winget upgrade yourself.

Claude Code also has a VS Code extension, a JetBrains plugin, a Desktop app, and a web version at claude.ai/code. All solid options. But the terminal is the foundation and everything else builds on top of it, so start here.

Logging In

Nothing to it. Navigate to any project directory and start Claude Code:

cd your-project
claude

First time, it opens a browser window asking you to sign in with your Anthropic account. Authorize, done. The session token is stored locally, so you won't need to log in again for a while.

If you ever need to check your auth status or re-authenticate:

# Check if you're logged in
claude auth status
 
# Log in again
claude auth login

No API keys to copy-paste, no environment variables, no config files. Sign in and go.

Your First Real Session

Most tutorials tell you to ask Claude Code to print "Hello World" or generate a todo app. Don't bother. You already know it can generate code. What you need to learn is how the interactive loop feels when you're doing real work.

Pick something real. Something small, but real. Open a project you're actively working on. Think of a task you've been putting off: writing tests for a file you just changed, refactoring a messy function, adding a missing error handler. Something you'd normally spend 10-20 minutes on.

Start a session:

cd ~/projects/your-actual-project
claude

You're in the interactive REPL. Type your request in plain English. Be specific. Instead of "fix my code," try "add input validation to the signup form in src/components/SignupForm.tsx. Email should be required and validated, password needs at least 8 characters."

Claude Code reads the relevant files, figures out what needs to change, and proposes edits. You see exactly what it wants to do before it does it. Approve or reject each action. That's the loop.

Try it: Right now, open a real project and run:

cd ~/your-project
claude "what are the 3 biggest code quality issues in this project?"

This starts a session with an initial prompt. Claude Code scans your codebase and gives you an honest assessment. It's read-only, so zero risk of it changing anything. You just get to watch how it navigates a codebase.

The Different Ways to Run It

The basic claude command starts an interactive session. But there are a few other modes you should know about from the start.

Interactive mode is what you'll use 90% of the time:

claude

You type, it responds, you type again. Back-and-forth conversation. You stay in control.

Start with a prompt when you already know what you want:

claude "add a retry mechanism to the API client"

Same interactive session, but kicks things off with your request instead of a blank prompt.

Print mode is for one-shot tasks. Process, print, exit. No conversation:

claude -p "explain what the main function in src/index.ts does"

Great for scripting or quick questions. You can pipe content into it too:

cat error.log | claude -p "what caused this error and how do I fix it?"

Continue mode picks up your most recent conversation:

claude -c

Closed the terminal, went to lunch, came back. claude -c puts you right where you left off with the full context restored.

Understanding the Interactive Loop

You ask, it plans, it acts, you confirm. That's the whole cycle. Get comfortable with it early.

When you make a request, Claude Code reads your files first. It figures out which files need to change. It proposes specific edits, and you see each one before it lands. This means you can be ambitious without being reckless. Ask for a big refactor. If the plan looks wrong, say no and redirect.

The session builds up context as you go. Fix a bug, then follow up with "now add a test for that fix," and it already knows which bug, which file, which function. Cumulative conversation within a session.

One thing people don't do enough: give feedback mid-session. If Claude Code does something 80% right, tell it what's wrong with the other 20%. It's a conversation, not a one-shot prompt.

What to remember

  • Native installer for auto-updates. Package managers need manual upgrades.
  • Auth happens once through the browser. claude auth status to check.
  • Skip the toy examples. Give it real work on a real project.
  • Interactive (claude), print (claude -p), continue (claude -c).
  • The loop: ask, plan, act, confirm.

Mastering Claude Code

Lesson 2 of 70