# 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.

- Source: https://doutorai.pt/en/blog/how-to-install-claude-code
- Author: Miguel Diamond (https://doutorai.pt/en/author/miguel)
- Category: Claude Code
- Published: Jun 29, 2026
- Site: Doutor AI (https://doutorai.pt/en) - AI tools for small businesses

## 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

## 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](https://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](https://doutorai.pt/en/blog/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:

- Navigate to the folder where you want to work. For example: cd documents/my-project

- Type claude in the terminal and press Enter.

- Claude Code generates an authentication link. Copy it or let it open automatically in the browser.

- Log in with your Anthropic account credentials. After confirmation, return to the terminal.

- 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](https://doutorai.pt/en/claude-code) has additional support resources and links to the official documentation.

## Frequently asked questions

### What is the minimum Node.js version to install Claude Code?

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.

### Can I install Claude Code without an Anthropic account?

You can install the software, but you cannot use it without authentication. Claude Code needs an active Anthropic account with a plan or API credits to work.

### What do I do if a permissions error appears during installation?

On Mac or Linux, try running the command with sudo: sudo npm install -g @anthropic-ai/claude-code. On Windows, open PowerShell as administrator before running the installation command.

### How do I update Claude Code to the latest version?

Run npm update -g @anthropic-ai/claude-code in the terminal. This command updates to the latest available version without needing to reinstall from scratch.

### Does Claude Code work without an internet connection?

No. Claude Code needs an internet connection to communicate with Anthropic's servers, where the AI model runs. Your local files are accessed directly, but the processing happens in the cloud.


---
Content by Doutor AI (https://doutorai.pt/en). When quoting, please cite the source: https://doutorai.pt/en/blog/how-to-install-claude-code
