zerotoclaude
Module 03/Claude Code Fundamentals/Lesson 02

Installing Claude Code

Step-by-step install on Mac, Windows, and Linux — with the gotchas called out.

8 min read

Installing Claude Code is genuinely quick — five minutes if your machine is set up, fifteen if you need to install Node.js first. This lesson walks through the actual steps on each platform, with the small gotchas called out.

What you need before you start

  1. A computer. Mac, Windows, or Linux. Any reasonably modern machine.
  2. Node.js (version 18 or newer). Claude Code is distributed as an npm package, so it runs on top of Node.
  3. An Anthropic account.Free to create. You'll sign in the first time you launch Claude Code.
  4. A terminal. Mac Terminal, Windows Terminal, PowerShell, or any decent terminal app.

Step 1: install Node.js

Visit nodejs.org and download the LTS (Long-Term Support) version. LTS is the recommended-for-most-people branch — well-tested, supported for years.

Run the installer. On all three platforms, it's "next, next, done."

To verify it worked, open a terminal and run:

terminal
node --version
npm --version

You should see version numbers print out — something like v22.11.0 for Node and 10.xor higher for npm. If you get "command not found," close and reopen the terminal — the new install needs a fresh shell to be visible.

Note
On Mac, many people prefer to install Node via Homebrew (brew install node) so it gets updated alongside other tools. Either way is fine.

Step 2: install Claude Code

From any terminal, run:

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

The -gmeans "global" — install it system-wide so you can run claude from any folder. Without -g, npm would install it only inside the current folder, which isn't what you want for a CLI tool.

You'll see a stream of download output, then it's done. Verify:

terminal
claude --version

That should print Claude Code's version.

If you get a permissions error
On Mac and Linux, global npm installs sometimes need administrator rights — you may have to prefix with sudo (sudo npm install -g @anthropic-ai/claude-code). On Windows, run the terminal "as administrator" for the install. There are also cleaner long-term fixes (nvm on Mac/Linux, for example) that avoid needing sudo at all.

Step 3: launch it

Navigate to any folder where you'd like to try Claude Code — even an empty one is fine for the first session. Then:

terminal
cd ~/Projects/my-first-claude-folder
claude

The first time you run claude, it'll open a browser window asking you to sign in to Anthropic and authorise the CLI. Sign in (or create the account), accept the prompt, and close the browser. Back in the terminal, Claude is now running. You'll see a welcome screen and a prompt waiting for you to type.

To exit a session, press Ctrl + D or type /exit.

Windows specifics

Most things work the same on Windows, but two things often trip people up:

  • Use Windows Terminal or PowerShell, not the old Command Prompt.The old cmd.exe doesn't support modern terminal features Claude Code uses for rendering.
  • WSL is worth considering. Windows Subsystem for Linux gives you a real Linux environment on Windows. Many tutorials assume Linux paths, and some npm packages work better there. Not required for Claude Code, but if you find yourself fighting Windows quirks, WSL is the escape hatch.

Updating Claude Code

Claude Code ships frequent updates. To get the latest, rerun the install command:

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

Or, more concisely:

terminal
claude update

That command pulls the latest version. Run it occasionally — the product moves fast.

If something goes wrong

The two most common install failures and their fixes:

  • "command not found: claude"after a successful install. This means Claude was installed but isn't on your PATH (the list of folders the shell searches for commands). The fix is usually to close and reopen the terminal. If that doesn't work, check npm config get prefix and make sure its bin sub-folder is in your PATH.
  • Authentication keeps failing.Make sure your system clock is accurate (auth tokens are time-sensitive) and you don't have a VPN or proxy interfering with the auth flow.
If you get stuck
The community discord and the official docs at claude.com/claude-code are both good places to search for install issues. Almost every install hiccup has been solved by someone before you.
What to take with you
  • Claude Code requires Node.js 18+. Install Node from nodejs.org.
  • Install Claude Code globally: npm install -g @anthropic-ai/claude-code.
  • Run claude in any project folder. First launch walks you through Anthropic sign-in.
  • On Windows, use Windows Terminal or PowerShell, not the old cmd.exe. WSL is a clean alternative if you hit Windows-only issues.
  • Update with claude update — do it monthly.