Skip to content
PD
Claude Code

How to Install Claude Code on Windows, macOS and WSL

System requirements, installing Claude Code on macOS, Linux, Windows and WSL, the first run and authentication, plus the install errors people actually hit and what they mean.

All articles in the guide Claude Code · 13

Installing Claude Code is rarely the hard part. What follows it can be: authentication, access, and the first run inside a real project.

Requirements

Not many:

  • A terminal you are willing to work in. The agent lives there.
  • Git in the project. Formally optional, practically required: without it you cannot see what the agent changed or roll it back.
  • A paid account or an API key - see API key.
  • Network access to the provider API. In Russia that is its own topic, covered in the access article.

Nothing special is needed from the hardware: the heavy work happens on the model side, and only your project’s own commands run locally.

macOS and Linux

The most direct route is the official installer, which brings its dependencies with it. The alternative is installing through npm, if Node is already present and you prefer keeping tooling in one place.

After installing, check that the command is visible from the terminal. If it is not, the directory holding the executable never made it into PATH. That is the most common snag, and it is one line in your shell config.

Windows

Two routes, and the choice is not cosmetic.

Native install. The agent works in your normal environment: PowerShell, Windows paths, programs installed system-wide. Right if the project builds on Windows anyway.

WSL. Ordinary Linux inside. Right if the project runs on Linux in production: the agent will run exactly the commands your CI runs.

A practical point: the most common source of strange Windows errors is mixing the two worlds. The project sits in the Windows filesystem while commands run in WSL, and you get slow I/O, permission conflicts and line-ending confusion. Keep the whole project on one side of that border.

On line endings specifically: if the repository is configured to convert them automatically, the agent may read a file in one form and write it in another, so the diff covers the whole file instead of three lines. That is not an agent bug, it is a git setting.

First run and authentication

The order:

  1. Change into the project directory. The agent works relative to the current directory, and that matters: it sees what is here.
  2. Start it. On first launch it asks you to authenticate, by subscription or by key.
  3. Give it a small task with an obvious success criterion - have it explain how one module works. That exercises the whole chain and changes nothing.
  4. Only then give it a task that edits files, and only on a clean git working tree.

The substantive advice: do not start with a large task. A first edit on a dirty working tree is how you lose track of what the agent changed and what you did.

Common install errors

  • Command not found. The directory is not in PATH. Restart the terminal; if that does not help, add the path yourself.
  • Permission denied during install. A global install into a system directory without rights. The correct fix is configuring a user-level directory for global packages, not running everything through sudo - otherwise some files end up owned by root and it bites you later.
  • An old Node version. Install succeeds, startup fails with an obscure syntax error. Check the version before looking anywhere else.
  • Runs but will not authenticate. That is no longer an install problem: see API key and access.
  • Starts but cannot see the project files. You launched from the wrong directory.

Next

From here: CLI commands and modes and configuring what the agent is allowed to do. The overview is in the Claude Code guide.

FAQ

Does Claude Code work on Windows?

Yes. There is a native Windows install and there is WSL, which gives you an ordinary Linux environment. WSL is usually more comfortable when the project already builds on Linux: the agent runs the same commands as your CI and does not trip over path and shell differences.

Do I need Node.js?

It depends on the install route. The platform installer brings what it needs with it; installing through npm requires Node. If you already have a recent Node, that route is shorter; if you do not, installing it purely for this is unnecessary.

Why does authentication disappear after a restart?

It is stored in your user profile, so you should not need to log in again. When it does drop every time, the usual cause is home directory permissions or running as a different user - under sudo, for instance, where the home directory belongs to somebody else.

More on this topic