Cookies

With your permission, we use Google Analytics cookies to measure visits and improve the site. Necessary cookies are always on. You can change your choice or withdraw consent anytime in the footer, under Cookie settings. Cookie Policy

Skip to content

Claude Code · 5 min

How to install Claude Code: a step-by-step guide for beginners

Install Claude Code in less than five minutes with this complete guide, from Node.js to your first terminal session.

Open glass box with a shiny metal cube coming out of it.

Quick answer

Installing Claude Code is simple and takes less than five minutes. The most direct method is through npm, with the command npm install -g @anthropic-ai/claude-code. Before you start, you need Node.js installed on your computer and an Anthropic account with an active plan or available API credits.

  • Install via npm with a single command in the terminal
  • Requires Node.js version 18 or higher installed first
  • Works on Windows, Mac, and Linux with no extra setup
  • On first use, you authenticate with your Anthropic account in the browser

Ask AI about this guide:

What you need before installing

Before installing Claude Code, make sure you have everything you need. The list is short, but each point matters:

  • Node.js version 18 or higher. Node.js is a JavaScript runtime that Claude Code needs to work. Check whether you already have it with the command node --version in the terminal. If a number below 18 appears, or if the command is not recognized, go to nodejs.org and install the LTS version. It's free and the installer does everything automatically.
  • npm available. npm is the package manager for Node.js and comes included with the installation. Check with npm --version. If a number appears, you're all set.
  • An Anthropic account with an active plan. You need an account at anthropic.com with a Claude plan (Pro or Max) or with API credits loaded. Without that, you can install Claude Code, but you can't use it. If you don't know which option to choose, read our article How much does Claude Code cost before continuing.

With these three points confirmed, you're ready to install.

Install Claude Code via npm

With Node.js installed, open the terminal. On Windows you can use PowerShell or Command Prompt. On Mac or Linux, use the Terminal application.

Type the following command and press Enter:

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

The -g flag means global installation. In other words, Claude Code becomes available system-wide and you can start it from any folder, without having to navigate to a specific directory first. The installation takes less than a minute on most internet connections.

To confirm the installation went well, type:

claude --version

If a version number appears on the screen, the installation succeeded. You can move on to authentication. If an error message appears, see the common problems section at the end of this article.

Other ways to install

npm is the most universal and recommended method, but there are alternatives in case you prefer:

  • Official Anthropic installer: Anthropic provides a direct installer in its official documentation at anthropic.com. It's a good option if you prefer not to use the command line for this initial step. The installer detects your operating system and sets everything up automatically.
  • Updating instead of reinstalling: When new versions of Claude Code come out, you don't need to reinstall. Just run npm update -g @anthropic-ai/claude-code and you have the latest version in seconds.

Whichever method you choose, the result is the same: the claude command becomes available in your terminal.

First launch and authentication

The first time you run Claude Code, it will ask you to log in to your Anthropic account. The process is simple and only happens once:

  1. Navigate to the folder where you want to work. For example: cd documents/my-project
  2. Type claude in the terminal and press Enter.
  3. Claude Code generates an authentication link. Copy it or let it open automatically in the browser.
  4. Log in with your Anthropic account credentials. After confirmation, return to the terminal.
  5. Claude Code shows a welcome message and is ready to use.

From here, you can start giving instructions in natural language. Type, for example, “explain what this file does” or “create a script that lists all files in this folder larger than 1MB” and see what happens.

Some useful commands to get started: /help shows what is available, /clear clears the conversation history, and /compact frees up memory in long sessions without losing the essential context.

Fixing common problems

If something doesn't go as expected, this table covers the most frequent cases:

ProblemLikely solution
“command not found: claude” after installationClose and reopen the terminal, then try again. If it persists, reinstall with npm install -g @anthropic-ai/claude-code
Permissions error on Mac or LinuxRun sudo npm install -g @anthropic-ai/claude-code and enter your system password when prompted
Node.js not found or version below 18Install or update Node.js at nodejs.org. Always choose the LTS version
Login doesn't work or returns an errorConfirm that you have an active plan or available credits at anthropic.com before trying again
Installation very slow or stopping midwayCheck your internet connection and try again. On slow networks, you can add --prefer-offline if you already had a previous installation

If you get stuck on a specific step, the Claude Code page on Doutor AI has additional support resources and links to the official documentation.

Components for this task

We hand-picked the agents, skills and commands that handle this kind of work: Agents and skills for DevOps, CI/CD and infrastructure.

Frequently asked questions

Node.js version 18 or higher is recommended. You can check which version you have with the command node --version in the terminal. If you need to update, go to nodejs.org and install the LTS version, which is free.

Want to put this to work in your business?

1,859 ready-to-copy AI prompts, by industry.

Get started - €7.99/month

Keep reading

Sources

  1. nodejs.org

Save hours every week with AI, no hassle

Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.

See plans