0 · Setup and installation
In this module you install Claude Code and talk to it for the first time. By the end you will have done the full round: a program installed, a login completed, a question asked about your code, a change proposed by an AI and saved in the project history. It is the most “mechanical” module of the course — lots of commands to copy, little theory — and that is fine: the theory starts in module 3, when you will have something working in front of you.
Objectives
Section titled “Objectives”- Check that your machine meets Claude Code’s system requirements.
- Install the CLI on macOS or Windows with the native installer, and know when Homebrew, WinGet or npm make more sense instead.
- Install the Claude desktop app and understand how it lives alongside the CLI.
- Authenticate with your account, without ever configuring a paid API key.
- Open your first session on a real project and close the first loop: question, change, commit.
Key concepts
Section titled “Key concepts”Starting from zeroTerminal, CLI, commands: the three words of this module
The terminal is the window where you give the computer orders by typing instead of clicking (how to open it). A CLI (Command Line Interface) is a program designed to be used from there: Claude Code is one. “Running a command” means: copying it into the terminal and pressing Enter. The rest of the module is just that, repeated.
Claude Code is an engine, not a single app. The same engine runs in four places: in the terminal
(the CLI), in the desktop app, inside VS Code and JetBrains, and on the web. They share the same configuration —
CLAUDE.md, MCP servers, hooks, skills and settings — so installing the CLI and the desktop app does not mean
maintaining two separate setups: it is the same setup with two interfaces. In this module you install the CLI and
desktop; VS Code and Antigravity come in module 1.
You need a paid subscription. Claude Code requires a Pro, Max, Team or Enterprise plan or a Claude Console account. The free Claude.ai plan does not include Claude Code. Throughout the course we use account login: a pay-as-you-go API key is not needed, and we will never ask for one.
The native installer is the recommended route. “Native” means it downloads a ready-made program
for your system (a binary), with no other tools needed, and puts it in
~/.local/bin/claude on macOS and Linux, in %USERPROFILE%\.local\bin\claude.exe on Windows. The
practical advantage is background auto-update: native installations keep themselves up to date
on their own, while Homebrew, WinGet and Linux package managers require a manual update. If you choose
one of those, put a brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode in your calendar
every so often.
There is also an npm package — the package manager of the JavaScript world, that is, the “store” from which
developers install libraries and tools. If npm is already part of your day, npm install -g @anthropic-ai/claude-code gives you the exact same native binary; if you don’t know what npm is,
ignore this route and use the native installer. Since v2.1.198 the package requires Node.js 22 or
higher.
On Windows you have two routes. Native Windows works with nothing else, but Git for
Windows is recommended: it provides Git Bash, which enables the Bash tool.
Without Git for Windows, Claude Code runs commands through the PowerShell tool. Alternatively you can
work inside WSL 2 (Windows Subsystem for Linux: a full Linux that runs inside Windows,
installed from the Microsoft Store). It is the only Windows configuration that supports
sandboxing, the “fence” that limits what commands can touch: if
you choose this route, you install and launch claude inside the WSL terminal, not from PowerShell.
System requirements. macOS 13.0+, Windows 10 1809+ or Windows Server 2019+, or Ubuntu 20.04+ / Debian 10+ / Alpine 3.19+. You need 4 GB of RAM, an x64 or ARM64 processor and an internet connection. The supported shells are Bash, Zsh, PowerShell and CMD.
The desktop app already includes Claude Code. You don’t need to install Node or the CLI to use it. It has three tabs —
Chat, Cowork and Code — and in this course we care about the Code tab: parallel sessions, visual diff,
integrated terminal, app preview. If you also want the claude command in the terminal, the CLI must be
installed separately: they are two distinct installations that share the configuration.
Guided example
Section titled “Guided example”-
Check what you already have installed.
If
claudeanswers, you already have an installation: note the version and skip to step 4.Terminal window claude --versionTerminal window claude --versionA working installation prints a version number followed by
(Claude Code):2.1.211 (Claude Code)If you get
command not found: claude(macOS) or'claude' is not recognized(Windows), carry on: you still need to install it. -
Install the CLI with the native installer.
The command below does two things in one: it downloads the official installation script (
curlis the tool that downloads things from the internet) and runs it right away, handing it over with a pipe (|). It is the most common form of installation in the developer world — and it should be used only with addresses you trust, like this one, which is Anthropic’s official one.Terminal window # downloads the installation script from claude.ai and runs itcurl -fsSL https://claude.ai/install.sh | bashAlternatively, with Homebrew (the most widely used package manager on macOS — if you don’t already have it, skip this alternative):
Terminal window brew install --cask claude-codeHomebrew offers two casks:
claude-codefollows the stable channel (typically one week behind, it skips releases with serious regressions),claude-code@latestfollows the latest channel. Neither auto-updates.In PowerShell:
Terminal window irm https://claude.ai/install.ps1 | iexIn CMD (a different command, not interchangeable):
Terminal window curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdYou don’t need to run as Administrator. How to tell which shell you are in: the prompt shows
PS C:\in PowerShell andC:\withoutPSin CMD.Alternatively, with WinGet:
Terminal window winget install Anthropic.ClaudeCodeWinGet does not auto-update: you will need to run
winget upgrade Anthropic.ClaudeCodeperiodically. -
Verify the installation.
Terminal window claude --versionclaude doctorTerminal window claude --versionclaude doctorclaude doctorprints a read-only diagnostic of installation and settings — without starting a session — including the installation status, any validation errors in the settings files and warnings with suggestions to fix them. It is the first command to run whenever something doesn’t add up. -
Log in with your account.
Move into a project folder and start a session. The key point: Claude Code works on the folder you start it from — that is its perimeter. Replace the example path with a real folder of yours (a code project if you have one; otherwise any folder with some text files is perfectly fine to begin with).
Terminal window # cd = "change directory": enter the project foldercd ~/progetti/il-mio-progetto# start Claude Code in that folderclaudeTerminal window # cd = "change directory": enter the project foldercd $env:USERPROFILE\progetti\il-mio-progetto# start Claude Code in that folderclaudeOn first launch Claude Code opens the browser for login — it is the “sign in with” mechanism you know from a thousand other services: you authorize from the browser, without ever typing your password in the terminal. Choose Claude Pro/Max (or your team’s account) and complete the sign-in. When login succeeds, the terminal shows
Login successfuland asks you to pressEnterto continue.If the browser doesn’t open by itself, press
cto copy the login URL to the clipboard and paste it manually. If the browser shows you a code instead of returning to the terminal, paste it at the promptPaste code here if prompted: this happens when the browser cannot reach the local callback server, typical of WSL2, SSH sessions and containers. -
Ask your first question.
You are inside the session. The prompt shows the version, active model and working directory. Write in natural language:
what does this project do?(= “what does this project do?” — you can also write to models in Italian or other languages, but in this course the prompts are in English because it is the language in which models work best on code)
Claude reads the files it needs on its own: you don’t have to add context by hand. Also try:
explain the folder structure(= “explain how this folder is organized”)
-
Make your first change and your first commit.
add a hello world function to the main fileClaude finds the right file, shows you the proposed changes and — depending on the active permission mode — asks for your approval before writing. On Pro, Max and Team plans the starting mode is
auto(a supervisor checks actions in the background and blocks the risky ones); indefaultmode you are asked to confirm every change. WithShift+Tabyou cycle through the modes. We cover them all in detail in module 6.Then close the loop by asking for a commit — git’s “signed save” that records the change in the project history (if git is a mystery, two minutes on The basics and come back here):
commit my changes with a descriptive message(in plain words: “save my changes with a descriptive message”)
To exit,
/exitorCtrl+Dtwice. -
Install the desktop app.
Download the installer and run it:
Download for macOS — universal build for Intel and Apple Silicon. Open the
.dmg, drag Claude into the Applications folder and launch it from there.Download for Windows x64 — or the ARM64 installer if you have an ARM PC. Run the setup and launch Claude from the Start menu.
For local sessions to work on Windows, Git must be installed.
Sign in with the same account, then click the Code tab at the top center. Choose Local, press Select folder and select the same project as before: you will find your
CLAUDE.md, MCP servers and skills, because desktop and CLI share the configuration.
Exercise
Section titled “Exercise”Set up your workstation and check it in a verifiable way, not by eye.
- Install the CLI with the native installer and confirm that
claude --versionprints a version. - Run
claude doctorand read the output: which installation method does it report? Does it auto-update? - Make sure your login is the subscription one and not an API key.
- Create a
claude-tutorial-esercizi/folder, enter it, startclaudeand have it create aREADME.mddescribing the course in three lines.
Solution
Steps 1–2.
curl -fsSL https://claude.ai/install.sh | bashclaude --versionclaude doctorirm https://claude.ai/install.ps1 | iexclaude --versionclaude doctorclaude doctor distinguishes the native installation from the others. If you installed with the native installer,
auto-update is active in the background and you don’t need to do anything. If you used Homebrew or WinGet, updating
is manual: brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode.
Step 3. Before starting the session, get any API key in the environment out of the way:
echo $ANTHROPIC_API_KEY # if it prints something, it is setunset ANTHROPIC_API_KEY$env:ANTHROPIC_API_KEY # if it prints something, it is setRemove-Item Env:\ANTHROPIC_API_KEYThen, inside the session, /status: the Login method line must show your subscription account.
If an API key line also appears, the key is still active and it wins: in Claude Code’s order of precedence,
a key in the environment variable beats the login done through the browser. That is why
we removed it before checking.
Step 4.
# create the folder and, IF creation succeeds ("&&"), enter itmkdir claude-tutorial-esercizi && cd claude-tutorial-eserciziclaude# create the folder, then enter it (";" = run in sequence)mkdir claude-tutorial-esercizi; cd claude-tutorial-eserciziclaudeThen, at the prompt:
create a README.md describing this folder as my Claude Code course exercises, three lines maxClaude shows you the proposed content and asks for confirmation before writing the file. Approve and check with
/exit followed by cat README.md (macOS) or type README.md (Windows).
Common mistakes & troubleshooting
Section titled “Common mistakes & troubleshooting”| Symptom | Cause | Solution |
|---|---|---|
command not found: claude / 'claude' is not recognized |
The installation directory is not in the PATH | See below: add ~/.local/bin (macOS) or %USERPROFILE%\.local\bin (Windows) to the PATH and reopen the terminal |
'irm' is not recognized as an internal or external command |
You are using the PowerShell command inside CMD | Use the CMD command, or switch to PowerShell |
The token '&&' is not a valid statement separator |
You are using the CMD command inside PowerShell | Use irm https://claude.ai/install.ps1 | iex |
'bash' is not recognized as the name of a cmdlet |
You pasted the macOS command on Windows | Use the PowerShell or CMD command |
syntax error near unexpected token '<' or curl: (22) ... error: 403 |
The installer returned HTML instead of the script (proxy or captive portal) | Check that the network reaches downloads.claude.ai, then retry |
Claude Code on Windows requires either Git for Windows (for bash) or PowerShell |
No usable shell is available | Install Git for Windows |
Error: claude native binary not installed |
Incomplete npm install: the optional dependencies were not downloaded | Reinstall allowing optional dependencies |
| Login: the browser shows a code instead of returning to the terminal | The browser cannot reach the local callback server (WSL2, SSH, container) | Paste the code at the Paste code here if prompted prompt |
| Login works but responses fail with authorization errors | ANTHROPIC_API_KEY in the environment takes precedence over the subscription |
unset ANTHROPIC_API_KEY, then check with /status |
App unavailable in region |
Claude Code is not available in your country | See the supported countries |
Fixing the PATH
Section titled “Fixing the PATH”First the concept, then the commands. The PATH is the list of folders where the terminal looks for
programs when you type a name: you type claude, and the terminal goes through those folders until it
finds a file with that name. If the installer put claude in a folder that is not
in the list, the program exists but the terminal can’t find it — hence the command not found.
The cure is to add that folder to the list. It is a small but permanent change to your
environment: that is exactly why the commands below are commented line by line.
Check whether the folder is already in the PATH:
# prints the PATH, one path per line, and looks for the exact line "~/.local/bin"echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin"If it prints the path, the PATH is fine and the problem is elsewhere. If it prints nothing,
add it. On macOS the default shell is Zsh, and its personal configuration file is
~/.zshrc — it is reread in every new terminal window:
# adds ONE line at the end of ~/.zshrc (">>" = "append, don't overwrite"):# the line says "from now on, also look for programs in ~/.local/bin"echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
# reloads the configuration in the current window, without having to close itsource ~/.zshrc
# check: now it must answer with the versionclaude --versionIf you suspect you have multiple conflicting installations (for example an old one via npm and a new native one):
# lists ALL the "claude" the terminal finds in the PATH, in order of precedencewhich -a claudeCheck whether the folder is already in the PATH:
# prints the PATH split on ";" and looks for the lines containing ".local\bin"$env:PATH -split ';' | Select-String '\.local\\bin'If it prints the path, the PATH is fine and the problem is elsewhere. If it prints nothing, add it to your user PATH (a permanent change, valid for all future windows):
# reads the user's current PATH...$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')# ...and saves it again with Claude's folder added at the end[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')Restart the terminal (windows already open don’t see the change) and check with
claude --version.
If you suspect you have multiple conflicting installations:
# lists ALL the "claude" the terminal finds, in order of precedencewhere.exe claudeCheat sheet
Section titled “Cheat sheet”| Command | What it does |
|---|---|
curl -fsSL https://claude.ai/install.sh | bash |
Native installer — macOS, Linux, WSL |
irm https://claude.ai/install.ps1 | iex |
Native installer — Windows PowerShell |
brew install --cask claude-code |
Installation via Homebrew (stable channel) |
winget install Anthropic.ClaudeCode |
Installation via WinGet |
npm install -g @anthropic-ai/claude-code |
Installation via npm (requires Node.js 22+) |
claude --version |
Prints the installed version |
claude doctor |
Installation and settings diagnostics, without starting a session |
claude update |
Applies an available update right away |
claude |
Starts an interactive session in the current directory |
claude "task" |
Starts a session and runs the given task right away |
/login |
Logs in again or switches account, from inside the session |
/logout |
Signs out of the account and resets the first-launch state |
/status |
Shows active account, login method and configuration |
/help |
Lists the available commands |
/exit or Ctrl+D twice |
Closes the session |
Shift+Tab |
Cycles through the permission modes |
Where things end up
| Item | macOS / Linux | Windows |
|---|---|---|
| CLI binary | ~/.local/bin/claude |
%USERPROFILE%\.local\bin\claude.exe |
| Installed versions | ~/.local/share/claude/versions/ |
%USERPROFILE%\.local\share\claude |
| Credentials | macOS Keychain (encrypted) · on Linux ~/.claude/.credentials.json, mode 0600 |
%USERPROFILE%\.claude\.credentials.json |
| User configuration | ~/.claude/ and ~/.claude.json |
%USERPROFILE%\.claude\ and %USERPROFILE%\.claude.json |
Sources
Section titled “Sources”Official pages consulted, checked on 16 August 2026:
- Advanced setup — system requirements, installation methods, updates, uninstalling
- Quickstart — first launch, login, essential commands
- Get started with the desktop app — installation and first session of the desktop app
- Authentication — account types, credential management, authentication precedence
- Troubleshoot installation and login — installation and login errors
- Supported countries — geographic availability
A course by Giuseppe Bosi · © 2026 · textCC BY 4.0, code MIT · last updated 29 October 2026 · contact: info@giuseppebosi.com
Author: Prof. Giuseppe Bosi (LinkedIn) · More courses (in Italian):JSON & API ·llama.cpp ·Build your own AI memory (RAG)· Source code on GitHub
Independent course, not affiliated with or endorsed by Anthropic or Google. Claude and Claude Code are trademarks of Anthropic; Antigravity and Gemini are trademarks of Google.
Every module lists its official sources with the date they were consulted. This site uses no cookies and collects no personal data.