Two routes, Mac and Windows. Every command has one-click copy, follow along and it works.
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.
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.Copy the line below, paste it into the terminal and press Enter. Give it 30 seconds to 1 minute to finish.
~/.local/bin/claude, then adds that path to your shell config.claude command gets recognised.If Homebrew is already installed, this line works too:
brew upgrade claude-code. I recommend the native install above (STEP 2), updating itself in the background saves you the trouble.Install it first for a smoother ride, Unix commands work that way. Without it, Claude Code falls back to running things in PowerShell.
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.Press the Start key, type powershell, then click Windows PowerShell to open it.
Copy the line below, paste it into the PowerShell window and press Enter. Wait for it to finish, 30 seconds to 1 minute.
powershell -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.claude command is added to your user environment variables.claude command gets recognised.Route A: use CMD (Command Prompt)
Route B: use WinGet (the package manager built into Windows)
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.
The token '&&' is not a valid statement separator?PS C:\ then you are in PowerShell, so use the PowerShell command from STEP 3 instead.In the terminal, Terminal on Mac or PowerShell on Windows, run:
Seeing a version number like 2.x.x (Claude Code) means the install worked.
command not found or is not recognized?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.
Pick a folder you want Claude to work in, cd into it, then run claude:
Next time you run claude you do not have to log in again, it remembers your account.
Once you are inside Claude Code, with the prompt starting with > as the first character, try these:
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.
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:
brew upgrade claude-codewinget upgrade Anthropic.ClaudeCodeMac / WSL:
Windows PowerShell:
rm -rf ~/.claude (Mac) or the matching PowerShell command. That wipes everything, so be sure.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.
execution policy error while running the install commandPowerShell blocks remote scripts by default. Run this line in PowerShell to unblock it, it only affects your own machine:
It asks whether you want to change the setting, press Y. Then go back and run the install command.
Look in the terminal for a URL starting with https://... and paste it into your browser yourself, same effect.
A few other free resources I wrote:
Useful? Cite this page and pass it on