Getting Started · Chapter 2
Install Claude Code
In the last chapter you learned how to open the terminal. In this one, we'll bring that "engineer who lives inside your computer" on board. Installing really just means pasting in one line, pressing Enter, and waiting for it to finish — there are step-by-step instructions for all three systems below. Just follow along; you don't need to understand what's going on under the hood.
2.1 The Big Picture: Three Ways to Install
There's more than one way to install Claude Code, but you only need to pick one — you don't have to do all of them. Let's get to know them with a quick table first, and by the end you'll know which path is right for you.
Native install (the official first choice — recommended for most people)
Copy the official one-line command, paste it into the terminal, press Enter, and it's installed. The biggest plus is that it quietly updates itself in the background, so you never have to upgrade by hand. There's a matching one-liner for Mac, Linux, and Windows.
Package manager (for people already using Homebrew / WinGet)
If your computer already uses Homebrew (Mac), WinGet (Windows), or apt/dnf/apk (Linux) to manage software, you can install with them and keep Claude Code alongside your other tools. The downside: this way doesn't update automatically, so you'll have to upgrade by hand.
npm (for people who already have a Node.js setup)
If you already write code with Node.js and have npm installed, you can use it to install too. But the official team no longer treats it as the first choice — we'll explain why below.
So why does the official team now push "native install" and no longer recommend first?
Why is npm no longer the recommended first choice?
Early on, Claude Code was installed through npm, but global npm installs often get stuck on "permission" problems (a flurry of permission errors during install), which isn't beginner-friendly. The native install doesn't have this headache, and it updates automatically, so the official team made it the first choice. Worth noting: even if you install with npm, what you get is the "same" native program — npm just wraps another layer around it. So if you don't have Node.js, there's no need to install it just for Claude Code.
Want the why: why doesn't the official team recommend npm?
What npm installs is the same native program, just with an extra layer wrapped around it; and installing globally with sudo npm often runs into permission problems and security risks, so the official team recommends going straight to the native install.
Don't want to choose? Just do this
If you're not sure, just use the "native install" one-liner in 2.2. It's the official first choice, it updates automatically, and it trips up beginners the least. From 2.2 on, we'll walk you through it step by step for each system.
2.2 Native Install: Just Paste One Line
This is the official first choice and the one we most recommend for beginners. There's only one move: copy the whole line that matches your system, paste it into the , and press Enter — leave the rest to it. Once installed, it updates itself in the background, so you won't have to think about upgrades again.
Use the tabs below to switch to your system. Windows takes a few more steps (because you have to tell its two windows, PowerShell and CMD, apart), so we cover it in detail in 2.3. This section starts with Mac, Linux, and WSL on Windows (the environment that runs Linux inside Windows, mentioned in Chapter 1).
The tabs switch the whole page together
Just like in Chapter 1, the Windows / Mac / Linux tabs in the top-right corner of the examples below all move together — switch one and the whole page switches, and it'll remember your choice when you move to other chapters. Pick your system first, then follow that column as you read on.
-
Try it
Pick your operating system
In the tabs below, click the system you're using (Windows / Mac / Linux) and it'll switch to the matching command. Switch one and the whole page follows.
-
Try it
Copy the whole line, paste it into the terminal, and press Enter
Click the "Copy" button in the top-right to grab the whole line, paste it into your terminal window, press Enter, and let it run on its own.
For a native Windows install (PowerShell or CMD), see the next section, 2.3, where we sort out the two kinds of windows. If you're using WSL (Linux inside Windows), use this line in your WSL window:
# WSL (Linux inside Windows): run this line in your WSL terminal curl -fsSL https://claude.ai/install.sh | bash# Mac: copy the whole line, paste it into Terminal, and press Enter curl -fsSL https://claude.ai/install.sh | bash# Linux: copy the whole line, paste it into the terminal, and press Enter curl -fsSL https://claude.ai/install.sh | bashWant the why: what does this curl line do?
This line downloads the installer from the official URL and runs it, placing Claude Code on your computer. It's a standalone program — you don't need Node.js first — and from then on it updates itself in the background.
-
Confirm it installed
After the command finishes, the terminal usually prints a message saying the install is done. If you see something like the following, it worked.
What you should see# You'll see roughly this kind of "install complete" message (the exact wording varies by version) Claude Code installed successfully Run claude to get started
After it's installed
Once it's done, the last step is to actually start it. In the project folder you want to work in, type a single word:
claude
What does "updates automatically" mean?
Claude Code installed the native way checks for and downloads new versions on its own — in the background, every time you start it and periodically while it's running — and the update takes effect the next time you launch. In other words, once you've installed it this once, you never have to worry about upgrades again. (If you installed with a package manager or npm, you'll need to update by hand; see 2.5.)
Native Windows users: it's worth installing Git for Windows while you're at it
If you're using Windows "natively" (not WSL), the official team suggests also installing the free Git for Windows (download it from git-scm.com) so Claude Code has a fuller set of command-line tools to work with. It still works without it — it'll fall back to PowerShell instead. Beginners can just keep this in mind for now and install it later if needed.
2.3 Installing on Windows: PowerShell and CMD Are Two Different Things, with Different Commands
The spot where Windows trips people up most isn't the install itself — it's "which one did you actually open, PowerShell or CMD?" The install commands for these two windows look completely different, and pasting the wrong one throws an error. Chapter 1 covered how to tell them apart; here's a quick refresher, followed by the correct command for each.
Tell which one you've opened in one second
Look at the string in front of the cursor: if it starts with PS (like PS C:\Users\YourName>), that's PowerShell; if there's no PS and it's just C:\Users\YourName>, that's CMD. Remember: PS means PowerShell.
How to open PowerShell (in case you forgot)
- Press the Windows key at the bottom-left of your keyboard (or click the Start button).
- Just start typing to search for
PowerShell. - Click "Windows PowerShell" to open it. (You don't need to "Run as administrator" for the install — opening it normally is fine.)
In PowerShell (starts with PS)
# PowerShell (cursor starts with PS): use this line
irm https://claude.ai/install.ps1 | iex
In CMD (Command Prompt, no PS at the start)
# CMD (Command Prompt, no PS at the start): use this line
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Pasting into the wrong window throws errors like these — don't worry, the message tells you where you pasted
- If you see
The token '&&' is not a valid statement separator(or that&&is invalid): you're in PowerShell but pasted the CMD command. Use the PowerShell line above instead (irm ...). - If you see
'irm' is not recognized as an internal or external command: you're in CMD but pasted the PowerShell command. Use the CMD line above instead (curl ...), or just open a PowerShell and paste theirmline there.
An easy way to remember: match the command to the window — they only work in pairs.
Are you using WSL?
If you've installed WSL and want to use Claude Code in "Linux inside Windows," then don't use this section's PowerShell/CMD commands — open your WSL window and use the Linux line from 2.2 (curl ... | bash). Do both the install and the launch in the WSL window, not in PowerShell/CMD.
2.4 Another Path: Use a Package Manager
If your computer already uses a "package manager" to install software (Homebrew on Mac, WinGet on Windows, apt/dnf/apk on Linux), you can install with those instead — the upside is managing Claude Code alongside your other software. Beginners who don't use these tools can simply skip this section and go back to the native install in 2.2.
Package-manager installs don't update automatically
Unlike the native install, Claude Code installed through a package manager won't update itself; you'll need to upgrade it by hand from time to time (the upgrade command is under each tab, and 2.5 sums them up too). If you want the "install it and forget it" experience, use the native install in 2.2.
Install with WinGet on Windows (run it in PowerShell):
# Install (WinGet)
winget install Anthropic.ClaudeCode
# To upgrade later, run this line by hand
winget upgrade Anthropic.ClaudeCode
Install with Homebrew () on Mac:
# Install (Homebrew)
brew install --cask claude-code
# To upgrade later, run this line by hand
brew upgrade claude-code
On Linux, pick the one for your distribution. Here's the apt example for Debian/Ubuntu:
# Debian / Ubuntu (apt): set up the official package source first, then install
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://downloads.claude.ai/keys/claude-code.asc \
-o /etc/apt/keyrings/claude-code.asc
echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main" \
| sudo tee /etc/apt/sources.list.d/claude-code.list
sudo apt update
sudo apt install claude-code
# Upgrade later
sudo apt update && sudo apt upgrade claude-code
Fedora / RHEL (dnf):
# Fedora / RHEL (dnf): set up the source, then install
sudo tee /etc/yum.repos.d/claude-code.repo <<'EOF'
[claude-code]
name=Claude Code
baseurl=https://downloads.claude.ai/claude-code/rpm/stable
enabled=1
gpgcheck=1
gpgkey=https://downloads.claude.ai/keys/claude-code.asc
EOF
sudo dnf install claude-code
# Upgrade later
sudo dnf upgrade claude-code
Alpine Linux (apk):
# Alpine (apk): download the key, add the source, then install
wget -O /etc/apk/keys/claude-code.rsa.pub \
https://downloads.claude.ai/keys/claude-code.rsa.pub
echo "https://downloads.claude.ai/claude-code/apk/stable" >> /etc/apk/repositories
apk add claude-code
# Upgrade later
apk update && apk upgrade claude-code
Already have Node.js? You can install with npm too
If you already have Node.js 18 or later, you can install globally with npm: npm install -g @anthropic-ai/claude-code, and upgrade with npm install -g @anthropic-ai/claude-code@latest. Please never put in front (sudo npm install -g) — the official team explicitly warns that this causes permission and security problems. If you don't have Node.js, there's no need to install it just for this; the native install in 2.2 is easier.
2.5 Confirm the Install, Check the Version, Update
Once it's installed, don't rush off — take ten seconds to confirm it really worked. The simplest way: ask it to report its own version number. It's the same on all three systems; type this line:
Suggested: verify it installed
claude --version
If it prints a version number (for example 2.x.x), congratulations — the install worked. If it replies command not found or 'claude' is not recognized as an internal or external command, it's either not installed yet or the path isn't set up — don't panic, just head straight to 2.6.
A more thorough checkup
To check more carefully whether the install and setup have any problems, use the official built-in "checkup command." It runs through your environment and tells you what needs fixing:
claude doctor
About updates
Do you need to update by hand? It depends on how you installed
- Native install (2.2): updates automatically in the background — you don't have to do anything. To jump to the latest version right now, type
claude update. - Package manager (2.4): doesn't update automatically; you'll run the upgrade command yourself (Homebrew:
brew upgrade claude-code/ WinGet:winget upgrade Anthropic.ClaudeCode/ apt and others, see 2.4). - npm: doesn't update automatically; upgrade by running
npm install -g @anthropic-ai/claude-code@latest.
Want to confirm an update worked?
Run claude doctor again and it'll tell you the result of the most recent update. You don't need to watch it day to day — it's a tool for when you "feel stuck on an old version."
2.6 Stuck? Match the Fix to the Symptom
Installs hit snags now and then — that's normal, and it's usually something small. Below are the situations beginners run into most often; find the one that matches. If yours isn't here, or you want the full list, there's a link to the official troubleshooting page at the end.
Typing claude says "command not found"
The most common one. Usually the install succeeded, but your system's "search path ()" doesn't include Claude Code yet. The quickest fix: close the terminal completely, open a fresh one, and type claude --version again. That sorts it out in most cases.
Windows reports && is invalid or 'irm' isn't recognized
You pasted into the wrong window (a PowerShell command into CMD, or the other way around). Go back to 2.3, match the command to the window, and use the right line.
Download fails, won't connect, or hangs for ages
Usually your network, a firewall, or a corporate network is blocking the download. Try a different network or turn off your VPN and try again; on a work computer you may need IT to set up a proxy. On Mac you can switch to Homebrew, and on Windows to WinGet, as a backup route.
claude errors out after an npm install
npm installs occasionally have permission or dependency issues. The easiest fix: switch to the native install in 2.2, which doesn't have these npm-specific headaches.
Full troubleshooting: the official page has it all
None of the above match your situation? The official team has an "Install and login troubleshooting" page that lists fixes for every error message (including PATH setup, 32-bit Windows, corporate certificates, login OAuth, and more). First run claude doctor in the terminal to see what it says, then cross-reference the official page: code.claude.com/docs/en/troubleshoot-install (see "Official sources" at the end of the chapter for the link).
Really stuck? You can bypass the terminal for now
If the terminal install just won't work and you're in a hurry, the official team also offers graphical options like the desktop app and the VS Code extension, so you can use Claude Code without touching the command line. The next section, 2.7, covers these choices.
2.7 Beyond the Terminal: VS Code, JetBrains, Desktop, and Web
This tutorial mainly teaches you to use Claude Code in the "terminal," because that's the most complete, full-featured way. But if you usually work inside a particular editor, or you'd rather not touch the command line at all, there are a few other entry points to choose from. Let's get to know them, then we'll give you advice on how to choose.
VS Code extension (the most popular graphical option)
If you use VS Code (or a fork like Cursor), you can install the official extension to turn Claude Code into a panel inside the editor: it shows a side-by-side diff before changing files so you can confirm, lets you tag files with @, and keeps your conversation history. In VS Code, press Ctrl/Cmd+Shift+X, search for "Claude Code," and install it. Note: the extension bundles its own copy for the panel to use, but if you also want to type claude in VS Code's built-in terminal, you still need to do the native install from 2.2 separately.
JetBrains extension (IntelliJ / PyCharm / WebStorm, etc.)
If you use a JetBrains IDE (IntelliJ IDEA, PyCharm, WebStorm, PhpStorm, GoLand, Android Studio…), go to the JetBrains Marketplace, search for "Claude Code," and install the plugin. Unlike the VS Code extension, it doesn't bundle its own copy, so you need to finish the native install from 2.2 first, then install this plugin.
Desktop app (for people who'd rather not touch the terminal at all)
The official team has a standalone desktop app (Mac and Windows) that you install and operate through a graphical interface, without typing a single command. It's ideal for older users, or anyone who just wants to get started quickly and isn't ready to learn the command line yet. Get it from the official download page.
Web version (Claude Code on the web, runs in the cloud)
Open it in a desktop browser (optionally paired with the Claude mobile app) and you're ready to go. The work runs on Anthropic's cloud servers, so it keeps going even if you close the browser, and you can check progress from the mobile app; using it requires linking your GitHub repository. For now it's aimed mainly at paid plans, and the actual availability and terms follow the official announcements. It isn't installed on your computer, which makes it fundamentally different from the "installed locally" methods above.
So which one should I pick?
- Want the most complete experience and to follow this tutorial → use the terminal (the one you installed in 2.2). The rest of this tutorial centers on the terminal.
- Already write things in VS Code / JetBrains → install the matching extension; using it as you write is the smoothest.
- Don't want to touch the command line and want to start fast → use the desktop app.
- Want to work from any computer's browser, or have it run in the cloud for you → try the web version (requires a paid plan + GitHub).
No need to rush through all of them. Pick one to start with — you can switch anytime later.
Congratulations — your engineer has reported for duty
You've now installed Claude Code on your computer and you know how to confirm it's alive. In the next chapter, we'll formally start it up and log in, so it can really begin working for you. With the install behind you, the fun part is all ahead.