Claude CodeClaude Code 2.1 · terminal and VS Code · macOS, Linux, Windows
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
32 small wins to finish your pathNext lesson →

Installation and setup

Installing Claude Code is a one-command setup that puts the CLI on your machine and signs it in to your Claude account.

Last updated: 29 Sep, 2026 · Claude Code

One command installs it, one starts it in a project, and the first question you ask is what shows it reading the code on its own. What matters is the answer you get back and what had to happen for it to be right.

Installing Claude Code and the first start · from the Complete Claude Code Course In 2 Hours For Developers · 31:31 to 36:40

The video installs from the documentation's quickstart, which has one command per system: macOS, Linux and WSL, Windows PowerShell and Windows CMD. Then it opens its project in Cursor, types claude in the terminal, and walks through the first start: a text style (it picks dark mode), a login method, a browser window to authorise the account, the security notes (Claude can make mistakes, and prompt injection is a risk, so use it with code you trust), and the recommended terminal setting that makes Shift+Enter a new line.

Models since the video. The video ran on Opus 4.7, the default at the time, with Sonnet 4.6 and Haiku 4.5 in the model picker. The default model is now Opus 5.5, and /model lists Opus 5.5, Sonnet 5.5, Haiku 4.5 and Fable 5.1 (model configuration).

A paid plan is needed to sign in: Pro, Max, Team or Enterprise, or an Anthropic Console account. The same install follows, command by command.

Install

On macOS, Linux or WSL:

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

On Windows PowerShell it is irm https://claude.ai/install.ps1 | iex, and Homebrew has it as brew install --cask claude-code. The installer script keeps itself updated in the background; the Homebrew cask does not, so that one needs brew upgrade now and then.

bash
claude --version
Captured from a real run
2.1.283 (Claude Code)

That number matters later. Claude Code ships changes weekly, and a lesson that mentions a flag will say which version it was checked against.

Start it in a project

Claude Code works in whatever directory you start it in. There is no project to create and nothing to index.

bash
cd link-shortener
claude

That opens the interactive session, which is where you will spend most of this course. The first time, it opens your browser so you can sign in with your Claude account.

Signing in

The browser asks which account to use: your claude.ai account on a Pro, Max, Team or Enterprise plan, or a Claude Console account. If the browser does not open, press c to copy the login link and paste it into one. When the terminal shows Login successful, press Enter.

No plan? A Claude Console API key works too, billed per token. Create one at platform.claude.com and set it before you start claude. The first time, Claude Code asks once whether to use it.

export ANTHROPIC_API_KEY=sk-ant-...

/status shows which login is in use and /logout signs you out. If a key and a plan are both set, the approved key wins; unset ANTHROPIC_API_KEY goes back to the plan.

In VS Code

If you write code in VS Code, the same Claude Code runs inside it as an extension, with a chat panel next to your files. It needs VS Code 1.94 or newer, and it installs the same way in Cursor.

  1. Open the Extensions view with Cmd+Shift+X on Mac or Ctrl+Shift+X on Windows and Linux, search for Claude Code, and install the one published by Anthropic.
  2. Open any file in your project. A Spark icon appears in the top right corner of the editor. Click it and the Claude panel opens.
  3. Sign in when the panel asks. Your browser opens, you sign in with your Claude account, and you come back to the panel.
  4. Type a question in the prompt box at the bottom and press Enter. Shift+Enter adds a new line without sending.

There are other ways in once it is installed: ✻ Claude Code in the status bar at the bottom right, the Claude icon in the Activity Bar on the left, and Claude Code: Open in New Tab from the Command Palette (Cmd+Shift+P or Ctrl+Shift+P). Claude Code: Open Walkthrough in the same palette gives a short guided tour of the panel.

No Spark icon?
The icon only shows while a file is open in the editor. With no file open, use the status bar or the Command Palette instead.

What the panel adds

Everything the terminal session does, the panel does too. On top of that it can see your editor.

In the panelWhat it does
Selected codeHighlight lines in the editor and Claude sees them with your next message. The footer of the prompt box says how many lines are selected.
Option+K / Alt+KInserts a reference to the open file and the selected lines, such as @app.py#5-10
@ mentions@shortener finds a file by part of its name, @src/ points at a folder, and @terminal:name hands over what a terminal printed
Proposed editsShown as a side-by-side diff against your file, to accept or reject
Mode indicatorAt the bottom of the prompt box. Click it to switch permission mode, where the terminal uses Shift+Tab
/ menuType / to see the commands and skills available, attach files, or switch model
Context indicatorShows how much of the context window is in use, which the context window and compaction lesson explains

One tool, two windows

The panel and the terminal are the same Claude Code. They read the same ~/.claude/settings.json, the same .claude/ folder and CLAUDE.md in your project, and they share conversation history, so claude --resume in a terminal can pick up a conversation you started in the panel. Every command, skill, hook and setting you put in .claude/ works in both.

The extension carries its own copy of Claude Code for the panel. To type claude in VS Code's integrated terminal (Ctrl+`, or Cmd+` on Mac), run the install command above once. One-shot commands such as claude -p run there.

Where the two differ
The panel offers a subset of the built-in slash commands, so type / to see which are there. It also has no ! shortcut for running a shell command and no tab completion. For any of those, run claude in the integrated terminal. If you prefer the terminal look inside VS Code, the extension setting Use Terminal switches the panel to it.

The first question

Rather than opening the interface, this lesson asks the same thing without it. The -p flag runs one prompt and prints the answer, which is the form that fits on a page. Everything it does is the same either way.

bash
claude -p "In one sentence, what does this project do?"
Captured from a real run
Shortens long URLs to compact codes and expands them back to original URLs.

Nothing was pasted in. No files were attached, no folder was uploaded, and no search index was built beforehand. It was given a question and a directory, and it went and read the project itself.

That single fact is what separates this from a chat window with your code copied into it, and the next lesson is about how it happens.

It can teach you the tool
Ask it about itself. claude -p "how do I set up hooks?" works, and so does asking inside a session. It has read its own documentation, which makes it a reasonable first place to look when this course has not covered something yet.

Everything after this lesson works on one tiny repository. Make a folder, add the three files below, and read them in order: the storage first, then the code that builds a short code. A bug is hiding in here that later lessons find and fix.

Storing links in a dictionary

The store keeps every code and its URL in one dictionary. A save with a code that already exists overwrites the old value, and nothing warns you.

python
links = {}                     # code -> url, in memory for now

def save(code, url):
    links[code] = url          # last write wins, no check

def find(code):
    return links.get(code)     # None if the code is unknown

def remove(code):
    links.pop(code, None)

def count():
    return len(links)          # how many links are stored

Turning a count into a short code

The code for a new link comes from how many links already exist. The count picks a letter and a number.

python
ALPHABET = "abcdefghijklmnopqrstuvwxyz"

def next_code():
    n = store.count()                        # links stored so far
    return ALPHABET[n % 26] + str(n // 26)   # a0, b0 ... z0, a1 ...

Shortening and expanding a URL

Shortening asks for the next code, saves the URL under it, and returns it. Expanding looks the URL back up.

python
def shorten(url):
    code = next_code()       # next code from the current count
    store.save(code, url)    # store the pair
    return code

def expand(code):
    return store.find(code)  # look the url back up by code

Save this as demo.py next to the other two files. Two links are saved, the first is deleted, and a third is added. Watch the last two lines.

Exampledemo.py
import shorten
import store

first = shorten.shorten("https://krishnaik.in/courses")
second = shorten.shorten("https://krishnaik.in/blog")

print("first :", first, "->", shorten.expand(first))
print("second:", second, "->", shorten.expand(second))

store.remove(first)
third = shorten.shorten("https://krishnaik.in/about")

print("third :", third, "->", shorten.expand(third))
print("second:", second, "->", shorten.expand(second))

The third link was given the code b0, which the second link already had, so saving it overwrote someone else's link. Nothing crashed and nothing printed a warning, which makes it a realistic bug to find.

The bug returns several times: when Claude finds it by searching, when it proposes tests before writing any, when an unattended run fixes it in four turns, and when you fix it again yourself in the last lesson.

Try it yourself
  • Run the same question in one of your own repositories and see how much it gets right.
  • Ask claude -p "what would you change first in this project?" and keep the answer for later.
  • Install the extension, select a function in the editor, press Option+K (Alt+K) and ask what it does.

Little by little, you're building something great.