Learn Claude Code Mastery Installing Claude Code and Your First Session

Installing Claude Code and Your First Session

Intermediate 🕐 20 min Lesson 2 of 10
What you'll learn
  • Install Claude Code on macOS, Windows, or Linux using the correct method for your platform
  • Authenticate with an Anthropic account and verify the installation works
  • Run a first session on a real project using a structured sequence of prompts

What You Need Before You Start

Claude Code requires two things: a supported operating system and an active Anthropic account.

Supported systems: macOS (Intel and Apple Silicon), Linux, Windows (native or via WSL2), and Windows Subsystem for Linux. You do not need Node.js or any other runtime pre-installed — the Claude Code installer handles its own dependencies.

Account requirements: You need one of the following:

  • Claude Pro ($20/month) — Full Claude Code access, but does not include Auto mode (which allows Claude to run without asking for permission at every step)
  • Claude Max ($100/month) — Full access including Auto mode and higher usage limits
  • Claude Team or Enterprise — Full access; admins control Auto mode availability
  • Console API access — Pre-paid credits, most flexible for developers and teams, no subscription required

If you are not sure which to choose: start with Pro. You can always upgrade to Max once you understand your usage patterns.

Installation

Pick the method that matches your platform:

macOS / Linux / WSL (Recommended)

curl -fsSL https://claude.ai/install.sh | bash

This is the fastest path. The installer downloads the Claude Code binary, sets up your PATH, and you are done in under a minute.

Windows (PowerShell)

irm https://claude.ai/install.ps1 | iex

Homebrew (macOS)

brew install --cask claude-code

Use this if you prefer managing software through Homebrew. Updates are handled with brew upgrade claude-code.

WinGet (Windows)

winget install Anthropic.ClaudeCode

npm (Any platform)

npm install -g @anthropic-ai/claude-code

Use this only if you specifically want to manage Claude Code through npm. The native installers above are simpler.

After installation, verify it worked:

claude --version

Authentication: How It Works

The first time you run claude, it opens your default browser automatically and takes you to claude.ai to log in. You grant the application permission, and your credentials are saved to your system's secure keychain (macOS Keychain, Windows Credential Manager, or a secure file on Linux). You will not need to log in again on subsequent sessions.

If you are using Console API access instead of a subscription, set your API key as an environment variable before running:

export ANTHROPIC_API_KEY=your-key-here
claude

Your First Session: A Real Walkthrough

Navigate to a project you already have on your machine. Any project works — the goal is to experience what Claude Code does when it sees a real codebase for the first time.

cd my-project
claude

Claude Code starts, reads your directory listing, and waits for a prompt. Here is the sequence of prompts to run in order:

Step 1: Let Claude understand the project

> What does this project do?

Claude reads your package.json (or requirements.txt, Cargo.toml, etc.), your README, and your main entry files. It summarizes the project in its own words. This is genuinely useful — you will often learn something about your own codebase from how Claude summarizes it.

Step 2: Understand the structure

> What is the folder structure and what does each directory do?

Claude walks through every top-level directory and explains its purpose based on what it finds inside.

Step 3: Generate your CLAUDE.md

> /init

This runs a special command that generates a starter CLAUDE.md file for your project. CLAUDE.md is covered in depth in the next lesson — for now, just know that it is the file that makes Claude Code remember your project conventions between sessions. The /init command creates a reasonable first draft by reading your project.

Step 4: Check for problems

> Run the tests and tell me if any are failing

Claude runs your test suite (it will figure out the command from package.json or similar). If tests are failing, it reads the error output and can propose a fix immediately.

Step 5: Your first real task

> Add a console.log to every API endpoint handler that logs the HTTP method and request path

Watch Claude find all your route files, read them, add the log statements, and show you exactly what it changed before asking for your approval. This is Claude Code working as intended: reading across multiple files, making targeted edits, and showing you the diff before anything is saved.

Keyboard Shortcuts to Know

Memorise these five shortcuts before anything else:

Shortcut What it does
Ctrl+C Interrupt Claude mid-response. Does not exit — Claude stops and waits for your next prompt.
Ctrl+D Exit Claude Code completely.
Shift+Tab Cycle through permission modes: default → acceptEdits → plan. More on this in Lesson 4.
/ Navigate your command history, just like a terminal.
Ctrl+R Reverse-search through your command history.

Type /help at any time to see all available commands.

Using Claude Code in VS Code

If you prefer working in VS Code rather than the terminal, install the Claude Code extension from the VS Code Marketplace. Once installed:

  • Open the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux) and search for "Claude Code" to launch the panel
  • Select code in your editor and reference it directly in your prompt using @
  • Changes appear as inline diffs you can accept or reject file by file
  • Your conversation history is preserved in the sidebar between sessions

Everything in this course applies equally to the VS Code extension and the terminal CLI. The underlying engine is the same — only the interface differs.

What You Have Now

At this point you have Claude Code installed, authenticated, and you have run your first real prompts on a live project. The next lesson covers the single most important configuration step: writing a CLAUDE.md file that makes Claude Code remember your project's conventions every time it starts.

Key takeaways
  • Install with one command on macOS/Linux: curl -fsSL https://claude.ai/install.sh | bash
  • Authentication happens via browser on first run — credentials are saved to your system keychain
  • The /init command generates a starter CLAUDE.md by reading your existing project
  • Ctrl+C interrupts Claude without exiting; Shift+Tab cycles permission modes
  • Run 'What does this project do?' at the start of every new project to orient Claude instantly