What you will learn
This is a Claude Code installation guide.
You will learn:
- What to prepare before installation.
- How to check Node.js.
- How to install Claude Code.
- What macOS, Linux, and Windows users should watch for.
- How to run
claude, sign in for the first time, and runclaude doctor. - How to troubleshoot common problems.
This guide does not assume you already know the terminal.
You only need to copy commands, press Enter, and read the output.
What does Claude Code do?
Claude Code is Anthropic’s AI coding tool.
It is not a web chat box.
It runs in your terminal. It can enter your project folder, read code, answer questions, and edit files after you approve.
For example, you can say:
Please read this Astro project first and tell me where the article files are. Do not change any code yet.
This kind of AI coding tool is useful for Web4 learners because you can build a project while asking AI to explain each step.
If you want to understand the concept first, start with the local AI coding agents guide.
What to prepare before installation
A computer
macOS, Linux, and Windows can all work.
If you are a beginner, macOS and Linux usually offer a more direct terminal experience.
Windows can work too, but you need to pay attention to the differences between PowerShell, Git Bash, and WSL.
A terminal
A terminal is a text window.
You type commands, and the computer returns results.
Common terminals include:
- macOS: Terminal or iTerm2.
- Linux: the built-in Terminal app.
- Windows: PowerShell, Windows Terminal, or a Linux terminal inside WSL.
Node.js
If you install Claude Code with npm, you need Node.js and npm first.
You can think of Node.js as the runtime that powers many frontend tools.
npm is the package manager that comes with Node.js. It installs command-line tools.
A Claude account
The first time you run Claude Code, you will need to sign in to Claude.
Follow the terminal prompts. Usually, it opens a browser so you can authorize the tool.
Check Node.js
Open your terminal and type:
node -v
If you see output like this:
v20.11.1
Node.js is installed.
Then check npm:
npm -v
If it shows a version number, npm is available too.
If you see command not found, your computer cannot find that command yet. Install Node.js from the official Node.js website, or use a version manager you already know.
Beginners should usually install the LTS version from the Node.js website.
Install Claude Code
The official docs provide multiple installation methods.
If you already have Node.js, the most direct path is npm:
npm install -g @anthropic-ai/claude-code
Here, -g means global. It installs claude as a global command.
After installation, check whether the command exists:
claude --version
If you see a version number, installation worked.
Do not rush into sudo npm install -g
If npm shows a permission error, you may find advice online like this:
sudo npm install -g @anthropic-ai/claude-code
Beginners should not rush into that.
sudo means administrator permissions.
It can sometimes push past the immediate error, but it can also make later npm package permissions more confusing.
Safer options are:
- Reinstall Node.js with a Node version manager.
- Follow the npm docs to change the global package installation directory.
- Use an official Claude Code installation method such as native install, Homebrew, or WinGet when available.
In short: when you see a permission error, fix npm permissions first instead of reaching for administrator permissions.
Notes for macOS users
macOS users usually have three choices.
Option 1: npm
If you already have Node.js:
npm install -g @anthropic-ai/claude-code
Option 2: native installer
The official Claude Code docs also provide a native installation method.
Use the latest command from the official page. This often avoids npm global permission issues.
Option 3: Homebrew
If you already manage developer tools with Homebrew, you can follow the official docs for Homebrew installation.
Homebrew is a common software installation tool on macOS.
If you do not know what Homebrew is yet, npm or the official native installer is usually easier.
Notes for Linux users
Linux users can also use npm:
npm install -g @anthropic-ai/claude-code
If you hit permission issues, do not immediately add sudo.
First check how Node.js was installed.
Many Linux users use a Node version manager such as nvm. It can install Node and npm inside your user directory, which reduces permission problems.
If you are using a company computer or server, confirm that you are allowed to install global commands.
Notes for Windows users
Windows users have a few paths.
Use Windows directly
You can use PowerShell or Windows Terminal.
Install Node.js first, then run:
npm install -g @anthropic-ai/claude-code
If the official docs provide a WinGet installation method, you can use the latest official instructions.
Use WSL
WSL is a Linux environment inside Windows.
If you plan to learn more frontend development, Web4, deployment, and Git, WSL is worth understanding.
But if you are just getting started, you do not need to wrestle with WSL immediately. Getting claude running matters more.
Run claude
After installation, enter a project folder.
For example:
cd my-first-website
Then type:
claude
The first time you run it, Claude Code will prompt you to sign in.
Follow the prompt, open the browser, sign in to your Claude account, and finish authorization.
After sign-in, you will return to the Claude Code session in your terminal.
What to ask first
Beginners should not start with “change my whole website.”
First ask Claude to inspect the project:
Please read this project first. Tell me what framework it uses, where the main pages are, and where the article content lives. Do not modify any files yet.
Then ask for a small task:
Please rewrite one homepage intro paragraph so it fits Web4 learners better. Only change necessary files and tell me what you changed.
This makes it easier to understand what Claude did.
Run claude doctor
Claude Code provides a check command:
claude doctor
You can think of it as a health check.
It checks Claude Code installation and environment issues.
If you run into sign-in, command, network, or permission problems, run this command first and follow the hints it gives.
Common problems
npm permission problems
Symptoms may include EACCES or permission denied.
Do not add sudo first.
Follow the npm docs for global package permissions, or reinstall Node.js with a Node version manager.
Node version is too old
If installation reports a Node version problem, run:
node -v
If the version is too old, install a newer LTS version from the Node.js website.
After installation, reopen the terminal and check again.
Sign-in fails
First confirm that your network can access Claude.
Then run:
claude
If it still fails, run:
claude doctor
Read the specific guidance it prints.
claude command not found
If the terminal says claude: command not found, installation may have failed, or your global npm command directory may not be in PATH.
Try:
npm list -g @anthropic-ai/claude-code
If the package is missing, reinstall it.
If the package exists but the command is still missing, check whether the npm global bin directory is in PATH.
Windows cannot open it after installation
Confirm that you are installing and running it in the same terminal environment.
For example, if you installed it in PowerShell, run claude in PowerShell first.
If you installed it inside WSL, run it inside the WSL terminal.
Next step
After installation, return to the local AI coding agents guide for the learning path.
Then try a small project: Build a Personal Website with Claude Code or Codex CLI.
If you also want to try OpenAI’s tool, continue with the Codex CLI Installation Guide.
Further reading
- Claude Code getting started - Anthropic
- Claude Code quickstart - Anthropic
- Node.js downloads - Node.js
- Resolving EACCES permissions errors when installing packages globally - npm Docs
FAQ
Do I need to know programming before installing Claude Code?
No. You need to know how to open a terminal, copy commands, and read basic prompts. You can start the coding part by asking Claude to explain a project.
Why should beginners avoid sudo npm install -g?
sudo installs global packages with administrator permissions, which can create later permission problems. npm also recommends fixing EACCES errors by using a Node version manager or changing npm's default directory.
Can Claude Code work offline?
It is better not to think of it as an offline tool. It runs in your local terminal, but it usually needs an internet connection to sign in and call the Claude service.