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.
黃志弘 Leo
Published 2026-04-09 · Updated 2026-08-14 · 3 readers
It takes 5 minutes and 1 line of command to install, and you need no coding background at all.
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.
Three things to know first
- Claude Code is Claude running inside your terminal, so it can read and write files on your computer, run commands, edit code and work on a project
- It needs a paid account: Claude Pro, Max, Team, Enterprise or the Console API, any of them works. The free Claude.ai plan does not
- The commands on this page follow Anthropic's official native install, which updates itself in the background. If a command changes, go by the official docs.
- Do not want to touch the terminal? Claude Code now also has a desktop app (Mac / Windows), a web version (claude.ai/code) and IDE plugins (VS Code, JetBrains) . The terminal version is still the most complete and most advanced, and knowing your way around a terminal is a skill that outlives any single tool, so this page installs the terminal version.
• 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
1Installing on Mac
macOS 13 or later, 3 steps
Open the terminal
Press Cmd + Space to bring up Spotlight, type terminal, then press Enter to open the Terminal app.
你的名字@你的Mac ~ % on the left means you found it. That window is the terminal, and every command below gets pasted there followed by Enter.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 | bashThis 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.
claude command gets recognised.Install with Homebrew (if you already have brew)
If Homebrew is already installed, this line works too:
brew install --cask claude-codebrew upgrade claude-code. I recommend the native install above (STEP 2), updating itself in the background saves you the trouble.2Installing on Windows
Windows 10 1809 or later, or Windows 11
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.
- Open your browser at git-scm.com/downloads/win
- Download the 64-bit Git for Windows Setup
- Run the installer, keep every option at its default, click Next all the way through
- No restart needed afterwards
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.Open PowerShell
Press the Start key, type powershell, then click Windows PowerShell to open it.
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 | iexpowershell -ExecutionPolicy Bypass -Command "irm https://claude.ai/install.ps1 | iex"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.claude command gets recognised.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.cmdRoute B: use WinGet (the package manager built into Windows)
winget install Anthropic.ClaudeCodeRoute 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.
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.3Verify, log in, first run
Confirm the version number prints
In the terminal, Terminal on Mac or PowerShell on Windows, run:
claude --versionSeeing a version number like 2.x.x (Claude Code) means the install worked.
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.
Run the health check to confirm every dependency is there
claude doctorThis 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.
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
claude1. 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.
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 meIf 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.
4Day-to-day upkeep
Updating, health checks, uninstalling
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• Mac Homebrew:
brew upgrade claude-code• Win WinGet:
winget upgrade Anthropic.ClaudeCodeIf you ever want it gone completely
Mac / WSL:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claudeWindows PowerShell:
Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Forcerm -rf ~/.claude (Mac) or the matching PowerShell command. That wipes everything, so be sure.5Where people get stuck most
You installed it, but claude says command not found
claude says command not foundThe 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 when installing or running through npm
execution policy error when installing or running through npmYou only hit this error if you installed with npm. The PowerShell install command on this page doesn't run into it. PowerShell blocks the .ps1 scripts that npm creates by default. Run this line in PowerShell to unblock it, it only affects your own machine:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedIt 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:
- Vibe coding cheat sheet — 7 core techniques
- gstack install guide — 55 ready-made skills in one go
- Channels setup guide — wiring Claude Code to Telegram
- Claude Memory Framework — give Claude your business context to remember