繁中 →
visitors so far

Installing Claude Code in the terminal, the hand-held walkthrough

Two routes, Mac and Windows. Every command has one-click copy, follow along and it works.

← HomeAbout·Failure list·GitHub·Threads
5
minutes to install
1 line
of command is all it takes
0
coding background needed

Why you should learn to open the terminal even if you do not write code

In 2026 the strongest AI tools have all moved toward the terminal. Claude Code, Codex, the most complete and most advanced parts of them live on the command line. The reason is simple: the terminal can touch your files, run programs and call APIs, which a chat window cannot. Learning to open the terminal upgrades you from chatting with AI to having AI do the work. The skill is not tied to any one tool. Install Claude Code today, switch to something else tomorrow, the terminal is still the door.

Read this first

Three things to know first

System requirements:
• Mac: macOS 13.0 or later
• Windows: Windows 10 1809 or later, or Windows 11
• Memory: 4GB or more
• Network: it has to reach anthropic.com
1
Installing on Mac
macOS 13 or later, 3 steps
Mac STEP 1

Open the terminal

Press Cmd + Space to bring up Spotlight, type terminal, then press Enter to open the Terminal app.

A black or white window with something like 你的名字@你的Mac ~ % on the left means you found it. That window is the terminal, and every command below gets pasted there followed by Enter.
Mac STEP 2

Paste the install command and press Enter

Copy the line below, paste it into the terminal and press Enter. Give it 30 seconds to 1 minute to finish.

curl -fsSL https://claude.ai/install.sh | bash
What it does:
This line pulls the install script from Anthropic's official site and puts Claude Code in ~/.local/bin/claude, then adds that path to your shell config.

When it finishes you see a message like Successfully installed.
Close the terminal and open it again after installing, so the claude command gets recognised.
Mac STEP 3 (alternative)

Install with Homebrew (if you already have brew)

If Homebrew is already installed, this line works too:

brew install --cask claude-code
Difference: the Homebrew build does not update itself, you have to run brew upgrade claude-code. I recommend the native install above (STEP 2), updating itself in the background saves you the trouble.

2
Installing on Windows
Windows 10 1809 or later, or Windows 11
Win STEP 1

Install Git for Windows first (recommended)

Install it first for a smoother ride, Unix commands work that way. Without it, Claude Code falls back to running things in PowerShell.

  1. Open your browser at git-scm.com/downloads/win
  2. Download the 64-bit Git for Windows Setup
  3. Run the installer, keep every option at its default, click Next all the way through
  4. No restart needed afterwards
Why is it recommended? Claude Code often reaches for Unix commands like ls and grep internally. With Git Bash installed they run more smoothly. It still runs without it: the official docs say that with no Git Bash it falls back to the native Windows PowerShell.
Win STEP 2

Open PowerShell

Press the Start key, type powershell, then click Windows PowerShell to open it.

A window with a blue or black background and Windows PowerShell at the top means you found it. You do not need to use Run as administrator, normal permissions are fine.
Win STEP 3

Paste the install command and press Enter

Copy the line below, paste it into the PowerShell window and press Enter. Wait for it to finish, 30 seconds to 1 minute.

irm https://claude.ai/install.ps1 | iex
The most common mistake: pasting it into Command Prompt (cmd). If the black window is titled Command Prompt, you pasted in the wrong place and it answers with 'irm' is not recognized as an internal or external command. Two ways out: open PowerShell and paste there, or paste this line in cmd, which also installs it:
powershell -ExecutionPolicy Bypass -Command "irm https://claude.ai/install.ps1 | iex"
What it does:
irm is the PowerShell download command, iex is the run command. The whole line means: pull the install script from Anthropic and run it as soon as it lands.

After installing, the claude command is added to your user environment variables.
Close PowerShell and open it again after installing, so the claude command gets recognised.
Win alternatives

Do not want PowerShell? Three other routes

Route A: use CMD (Command Prompt)

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Route B: use WinGet (the package manager built into Windows)

winget install Anthropic.ClaudeCode

Route C: use WSL (the Linux subsystem for Windows)

If you know WSL, run the Mac command inside WSL: curl -fsSL https://claude.ai/install.sh | bash. WSL 2 also supports sandbox mode, which is safer.

Getting The token '&&' is not a valid statement separator?
That means you ran a CMD command in PowerShell. Check the prompt: if it begins with PS C:\ then you are in PowerShell, so use the PowerShell command from STEP 3 instead.

3
Verify, log in, first run
Same on Mac and Windows, just follow along
Check 1

Confirm the version number prints

In the terminal, Terminal on Mac or PowerShell on Windows, run:

claude --version

Seeing a version number like 2.x.x (Claude Code) means the install worked.

Seeing command not found or is not recognized?
99% of the time it is because you did not reopen the terminal after installing. Close it, open a new one, try again.
Check 2

Run the health check to confirm every dependency is there

claude doctor

This command checks your install, settings, network, fonts, shell integration and so on. A row of green ✓ means you are good. If anything shows a red ✗, it tells you how to fix it.

Log in

First launch and logging into your Anthropic account

Pick a folder you want Claude to work in, cd into it, then run claude:

cd ~/Desktop/my-project claude
What happens on the first run:
1. Claude Code asks which account you want to log in with (Pro/Max/Console)
2. A browser window opens and asks you to log in
3. Log in with your Anthropic account in the browser and click Authorize
4. Back in the terminal you see Login successful
5. Then you land in the Claude Code chat interface and can start giving instructions

Next time you run claude you do not have to log in again, it remembers your account.

First try

Try these simplest instructions

Once you are inside Claude Code, with the prompt starting with > as the first character, try these:

What is in this folder?
Write me a hello.py that does print("Claude Code is installed")
Run hello.py for me

If those three create the file, run it and print output, congratulations, you can use Claude Code. The rest is deciding what you want it to do for you.


4
Day-to-day upkeep
Updating, health checks, uninstalling
Updating

The native install updates itself

With the native install from STEP 2 / STEP 3, Claude Code downloads new versions in the background and they take effect the next time you launch it. You do not have to do anything.

To update right now:

claude update
If you installed with Homebrew or WinGet, update manually:
• Mac Homebrew: brew upgrade claude-code
• Win WinGet: winget upgrade Anthropic.ClaudeCode
Uninstalling

If you ever want it gone completely

Mac / WSL:

rm -f ~/.local/bin/claude rm -rf ~/.local/share/claude

Windows PowerShell:

Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force
Note: that only removes the program itself. If you also want every setting gone, MCP config, chat history and the skills library included, run rm -rf ~/.claude (Mac) or the matching PowerShell command. That wipes everything, so be sure.
5
Where people get stuck most
99% of people get stuck on one of these

You installed it, but claude says command not found

The most common one. Close the terminal and open a new one, because the claude command is only recognised in a new shell session.

Windows throws an execution policy error while running the install command

PowerShell blocks remote scripts by default. Run this line in PowerShell to unblock it, it only affects your own machine:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

It asks whether you want to change the setting, press Y. Then go back and run the install command.

The browser does not open when you log in

Look in the terminal for a URL starting with https://... and paste it into your browser yourself, same effect.

You want the advanced usage after installing

A few other free resources I wrote:

Useful? Follow me

More AI tool guides and one-person company notes from the field

@kanisleo328

Useful? Cite this page and pass it on