4Geeks chosen to deliver AI education in the Bahamas alongside Harvard, Oxford, and Columbia.See more

How to Install Claude Code on Mac, Windows & Linux

By 4Geeks

Install Claude Code on Mac, Windows or Linux, check that it works, log in and start your first session with the commands you'll use every day.

8 min readLast updated
Install Claude Code icon

How do you install Claude Code?

Short answer: open a terminal and run the official installer. On Mac, Linux or WSL that's curl -fsSL https://claude.ai/install.sh | bash. On Windows, in PowerShell, it's irm https://claude.ai/install.ps1 | iex. Then check it with claude --version, go into your project folder and type claude to log in and start your first session.

bash
claude --version
2.1.322 (Claude Code)

If you see a version number followed by (Claude Code), it's installed. Your number will probably be newer: Claude Code updates itself often.

Install Claude Code, check the version and start your first session.

What you need before installing

  • An account that includes Claude Code: Claude Pro, Max, Team or Enterprise, or a Claude Console account with API credits. The free Claude.ai plan doesn't include Claude Code.
  • A supported system: macOS 13 or later, Windows 10 (1809) or later, Ubuntu 20.04+, Debian 10+ or Alpine 3.19+, with 4 GB of RAM or more.
  • An internet connection and a terminal: Terminal on Mac, PowerShell on Windows, or your Linux shell.

You don't need Node.js for the official installer. You only need it if you choose to install with npm.

Install Claude Code: every option

bash
# Mac, Linux and WSL: official installer (recommended)
curl -fsSL https://claude.ai/install.sh | bash
 
# Windows PowerShell: official installer (recommended)
irm https://claude.ai/install.ps1 | iex
 
# Windows CMD: official installer
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
 
# Mac with Homebrew
brew install --cask claude-code
 
# Windows with WinGet
winget install Anthropic.ClaudeCode
 
# Any system with Node.js, with npm
npm install -g @anthropic-ai/claude-code

The official installer is the best option for most people: it doesn't need Node.js and it keeps Claude Code updated in the background.

Install Claude Code on Mac or Linux

Open the terminal and run:

bash
curl -fsSL https://claude.ai/install.sh | bash

The script downloads Claude Code, checks it and sets it up. At the end it prints ✅ Installation complete!. Open a new terminal and check it:

bash
claude --version

Don't run the installer with sudo. Claude Code installs into your home folder and doesn't need root access; with sudo it would install for the root user and the claude command wouldn't work from your own terminal.

On Mac you can also use Homebrew: brew install --cask claude-code. In that case Homebrew handles the updates with brew upgrade claude-code.

Install Claude Code on Windows

Open PowerShell (not as administrator) and run:

powershell
irm https://claude.ai/install.ps1 | iex

If you prefer WinGet:

powershell
winget install Anthropic.ClaudeCode

Close and reopen the terminal, then run claude --version. Installing Git for Windows is recommended: Claude Code uses its Bash to run commands. Without it, Claude Code uses PowerShell instead. If you work inside WSL, install it with the Linux command from the WSL terminal.

Install Claude Code with npm

If you already work with Node.js, you can install it as a global npm package:

bash
npm install -g @anthropic-ai/claude-code

The current package declares Node.js 22 or later, so check your version first with node -v. Never use sudo npm install -g: if you get permission errors, install Node.js with nvm. If you don't have Node.js yet, see how to install JavaScript (Node.js).

Career · AI Engineering for Developers

You already code with an AI agent, now build AI apps yourself

Use the coding skills you already have to build AI agents, RAG systems and LLM-powered apps, with mentors and real projects.

Log in and start your first session

Go into your project folder and start Claude Code:

bash
cd my-project
claude

The first time, Claude Code asks you to log in. Choose your Claude subscription (Pro, Max, Team or Enterprise) or your Claude Console account and finish in the browser that opens. You only do this once; to switch accounts later, type /login inside the session.

From there you talk to it in plain language. It reads your project's files, proposes changes and asks for permission before editing files or running commands. Try a first question:

what does this project do?

To exit, type /exit or press Ctrl + D twice. To pick up where you left off, run claude -c in the same folder.

The first commands you'll use

CommandWhat it does
claudeStarts an interactive session in the current folder
claude "task"Starts a session with a first prompt
claude -p "question"Answers once and exits, without opening a session
claude -cContinues the most recent conversation in this folder
/initCreates a CLAUDE.md guide for the project
/helpShows the available commands
/clearStarts a new conversation with empty context
/compactSummarizes the conversation to free up context
/modelChanges the AI model
/resumeOpens a previous conversation
/usageShows the session cost and your plan's usage limits
/exitExits Claude Code

Type / inside a session to see every command. Shift + Tab cycles between permission modes.

Create a CLAUDE.md for your project

Run /init inside a session. Claude Code analyzes your code and creates a CLAUDE.md file with the build and test commands and the conventions it finds. If a CLAUDE.md already exists, /init suggests improvements instead of overwriting it.

CLAUDE.md is a Markdown file with instructions Claude reads at the start of every session:

FileWhat it's for
./CLAUDE.mdTeam instructions for the project (commit it to Git)
./CLAUDE.local.mdYour personal preferences for this project (add it to .gitignore)
~/.claude/CLAUDE.mdYour preferences for every project

To see or edit them, use /memory. You can also ask: "add this to CLAUDE.md".

Use Claude Code in VS Code

Claude Code also comes as a VS Code extension. Open the Extensions view (Ctrl + Shift + X on Windows and Linux, Cmd + Shift + X on Mac), search for Claude Code, from Anthropic, and click Install. You need VS Code 1.94.0 or later. The extension brings its own copy of Claude Code; if you also want to type claude in VS Code's integrated terminal, install it with one of the commands above. To set up the editor for JavaScript, see how to run JavaScript in VS Code.

Your first prompts in Claude Code

Claude Code works best when you tell it what you want and how to check it. These prompts are ready to copy into your first session.

1. Understand a project you've just cloned

Explain the folder structure of this project, where the entry point is
and which command I use to run it and to run the tests.

2. Make a small, checkable change

Add input validation to the registration form so it rejects empty emails.
Show me the plan before editing, then run the tests.

3. Work with Git

Show me which files I changed, write a descriptive commit message
and create a new branch called feature/validation.

If you don't have a project yet, clone one first: how to clone a GitHub repository.

Learn with a mentor

From using Claude Code to shipping AI features

In the 4Geeks AI Engineering for Developers program you add AI agents, RAG and production LLM apps to your portfolio.

Common errors when installing Claude Code

What you seeWhy it happensFix
command not found: claude or 'claude' is not recognizedThe terminal was open before the install, or the install folder isn't in the PATHOpen a new terminal; on Mac or Linux check that ~/.local/bin is in your PATH
Error: do not run this installer with sudo.You ran the installer with sudoRun the same command without sudo: Claude Code installs into your home folder
You can't log in with your free accountThe free Claude.ai plan doesn't include Claude CodeUse a Pro, Max, Team or Enterprise plan, or a Claude Console account with credits
Failed to get a valid version from downloads.claude.aiThe download service is unreachable or not available in your regionCheck your connection or proxy, and Anthropic's list of supported countries
npm ERR! code EACCES with npmPermission problem in system foldersDon't use sudo npm; use the official installer or install Node.js with nvm
Something else failsSettings, versions or several installs mixed upRun claude doctor in the terminal, or /doctor inside a session

Update or uninstall Claude Code

The official installer updates Claude Code by itself in the background. To update right away:

bash
claude update
Installed withUpdateUninstall
Homebrewbrew upgrade claude-codebrew uninstall --cask claude-code
WinGetwinget upgrade Anthropic.ClaudeCodewinget uninstall Anthropic.ClaudeCode
npmnpm install -g @anthropic-ai/claude-code@latestnpm uninstall -g @anthropic-ai/claude-code

To uninstall the official install on Mac, Linux or WSL, delete its two folders:

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

Your settings and history stay in ~/.claude. Delete that folder only if you want to remove them too: it also deletes your permissions and MCP server settings.

Free download

Install Claude Code in a 2-page cheat sheet

Install commands for Mac, Windows and Linux, how to check it and log in, the first commands, CLAUDE.md, common errors and how to update or uninstall it. Free, in PDF.

Install Claude Code cheat sheet

2 pages · PDF · 4Geeks

  • Every install command, by system
  • The first commands and how CLAUDE.md works
  • Common errors, updates and uninstall

Get it free

Your PDF right away

Frequently asked questions about installing Claude Code

Want to go from using Claude Code to building your own AI applications, with real projects and mentors?

See the AI Engineering for Developers program