← Blog

How to Install Anthropic Claude Code (Step by Step)

2026-09-13 · 4 min read · SubToAPI Team

Claude Code is Anthropic's command-line coding agent, and installing it takes three steps: install Node.js, run one npm command, then authenticate with your Anthropic account. The whole process usually takes under five minutes on macOS, Linux, or Windows (via WSL).

This guide walks through the prerequisites, the actual install command, authentication, and the most common problems people hit — plus what to do if you want to expose the same underlying Claude access as an API instead of a terminal tool.

Prerequisites

Before installing, make sure you have:

Check your Node version first:

node --version

If it prints anything below v18.0.0, update Node before continuing. On macOS, the easiest path is Homebrew:

brew install node

On Linux, use your distribution's package manager or a version manager like nvm so you can pin a specific Node release without touching system packages.

Installing Claude Code

Once Node is in place, install Claude Code globally with npm:

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

This puts a claude binary on your PATH. Verify it worked:

claude --version

If the command isn't found, your global npm bin directory probably isn't on your PATH. Run npm config get prefix to find where global packages are installed, then add <prefix>/bin to your shell's PATH in .zshrc, .bashrc, or the equivalent.

Installing on Windows

Claude Code requires a Unix-like environment, so on Windows you need WSL2:

wsl --install

Reboot if prompted, open your WSL distribution (Ubuntu is the default), then follow the Node.js and npm install steps above inside WSL — not in PowerShell or CMD.

Installing on Linux without root

If you don't have permission to install npm packages globally, use npm install -g with a user-level prefix, or install Node via nvm, which keeps the entire toolchain (Node, npm, and anything installed with -g) inside your home directory without needing sudo.

Authenticating Claude Code

The first time you run claude in a project directory, it will prompt you to authenticate:

cd your-project
claude

You'll be given a choice between:

  1. Logging in with your Claude.ai account (Pro or Max subscription) — this opens a browser window for OAuth-style login.
  2. Using an Anthropic API key — useful if your organization manages billing through the API console rather than a consumer subscription.

Pick the option that matches how your Anthropic access is set up. Once authenticated, Claude Code stores credentials locally so you don't need to log in again on every session.

Running Your First Command

With installation and auth done, try Claude Code inside a real project:

cd path/to/your/repo
claude

This drops you into an interactive session where you can ask Claude to read files, explain code, write tests, or make edits directly in your working directory. You can also run one-off, non-interactive commands:

claude -p "summarize what this repository does"

Keeping Claude Code Updated

Claude Code updates fairly often. Reinstall the latest version with:

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

If you're using nvm with multiple Node versions, remember that global packages are installed per Node version — switching Node versions may mean reinstalling Claude Code.

When You Need API Access Instead of a CLI

Claude Code installs a terminal tool that talks to Claude on your behalf — it's built for interactive coding sessions in your shell. But if you're building a product, an internal tool, or an automated pipeline and need to call Claude from your own backend, a CLI isn't the right shape. That's a different problem: you need HTTPS endpoints, application-specific API keys, and usage tracking your team can actually manage.

This is where SubToAPI fits. It turns the Claude access you already have into a proper API surface: generate scoped sub_live_... keys per app, hit standard REST endpoints, get streaming and tool use support, and see usage metadata per key from one dashboard — instead of wiring raw credentials into every service that needs Claude. It's a complement to Claude Code, not a replacement: use Claude Code in your terminal for development, and SubToAPI when you need to serve Claude-powered features from your own applications.

Getting started looks like:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Check the quickstart for full setup, messages for the request format, streaming if you need token-by-token output, and tools for function calling. Plans start at Solo (€9), scale up to Team and Scale seats, and there's a free trial at signup — see pricing for details.

Questions

Do I need an Anthropic API key to install Claude Code? No. You can authenticate with either a Claude.ai subscription login or an API key — Claude Code supports both, so a standalone subscription is enough to get started.

Can I install Claude Code on Windows directly? Not natively. Claude Code requires a Unix-like shell, so on Windows you need to install it inside WSL2, not in PowerShell or Command Prompt.

Why does claude say "command not found" after installing? This almost always means your global npm bin directory isn't on your PATH. Run npm config get prefix, add <prefix>/bin to your shell config file, then restart your terminal.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →