Setup GuideClaude CLIToolsOnboarding

    Claude CLI Setup Guide — Install, Authenticate, and Build Your First Project (2026)

    The fastest, friction-free way to get Claude CLI running on your machine. Three prerequisites, one install command, one auth flow — and you're coding 10x faster. The exact commands, the gotchas, and the verification checklist.

    RaffiApril 8, 20268 min read

    Half the developers I talk to who are "thinking about trying Claude CLI" haven't started for the same reason: they're not sure if their setup is ready, and they don't want to fight a 30-step install guide before they see anything work. Good news: there are exactly three prerequisites, one install command, and one authentication flow. Total real-world setup time: about 5 minutes if you have everything in place, 15 if you don't.

    The video above is the live walkthrough on a fresh Windows machine. This article is the printable companion — copy-paste the commands, tick the checks, and you're done.

    Prerequisite 1 — Node.js 18 or higher

    Claude CLI is a Node package, so you need a Node runtime. Anything 18.x or newer works. If you're not sure what you have, run the version checks first — you may already be set.

    # If both of these print a version, skip ahead.
    node --version
    npm --version

    Don't have it? Grab the LTS installer from nodejs.org/en/download and accept the defaults. After install, open a fresh terminal (important — old terminals don't see the new PATH) and run the version checks again. You're looking for v18 or higher.

    Prerequisite 2 — Git

    Claude CLI uses git for version control awareness — and you'll want git anyway, because you're going to be generating a lot of code and the first thing you'll want is `git init`.

    • Windows: download from git-scm.com/downloads/win and run the installer with default options. This also installs Git Bash, which is a nicer terminal than the default cmd.exe.
    • macOS: `git --version` will trigger a system prompt to install Xcode Command Line Tools, or use Homebrew (`brew install git`).
    • Linux: `apt install git` / `dnf install git` / `pacman -S git` — pick your distro's package manager.

    Prerequisite 3 — Anthropic access

    Claude CLI needs a way to talk to Claude. You have two clean options — pick one, not both:

    • Anthropic subscription — Go to claude.ai/upgrade and pick Pro or Max. The CLI will authenticate against your subscription via the browser flow. This is the simplest path if you're a daily Claude user.
    • Anthropic API key — Go to console.anthropic.com, create an account, add a few dollars in credits, and generate an API key. This is the right path if you want metered, pay-as-you-go usage or you're using Claude CLI on a shared machine.

    Install Claude CLI

    Now the actual install. One command — globally, so it's available from any folder.

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

    Quick decoder for what just happened:

    • `npm install` — we're installing a package.
    • `-g` — "global", so the `claude` command works from any directory, not just one project folder.
    • `@anthropic-ai/claude-code` — the official package name. If you see a fork with a different name, it's not the official one.

    It usually finishes in about 30 seconds depending on your connection. When it's done, verify:

    claude --version

    Authenticate

    One more command, then you're ready to build.

    claude auth login

    Your browser pops open. You log in to your Anthropic account. You authorize the CLI. You see a success message in your terminal. That's the whole flow.

    If the browser flow doesn't work — corporate firewall, headless server, container — fall back to the API key path. You'll need the key from console.anthropic.com:

    claude auth login --api-key YOUR_KEY_HERE

    Verify with a real first task

    The fastest way to confirm everything works is to actually build something. Two minutes, a clean folder, and one prompt:

    mkdir hello-claude
    cd hello-claude
    claude

    Inside the CLI, paste a small test prompt — a real one, not just "hello world":

    Create a Node.js script that fetches a random programming joke from an API and prints it nicely formatted in the terminal. Include a README explaining how to run it.

    If Claude plans, generates `index.js` and a README, and explains how to run it — you're done. Setup verified. From here, the only limit is the prompts you can think of.

    Common gotchas (so you don't waste an hour)

    • "command not found: claude" right after install — open a new terminal. The PATH only updates for new shells.
    • Browser auth hangs — disable corporate VPN/proxy temporarily, or fall back to the `--api-key` flow.
    • Permission errors on `npm install -g` (macOS/Linux) — don't `sudo`. Fix npm's prefix instead, or use a Node version manager like `nvm`.
    • Windows shows weird unicode in the terminal — switch to Git Bash or Windows Terminal; legacy cmd.exe doesn't render well.

    What to read (and watch) next

    Now that the CLI is live, the natural next step is to build something real. The Build Your First App in 10 Minutes tutorial walks you through a complete Express REST API from a single prompt — same setup, same machine, instant payoff. After that, the Power Tips chapter in the Claude Code book on this site is the shortcut to professional-grade prompting: --review mode, context management, working in existing repos, and the small habits that turn Claude CLI from a toy into a daily driver.

    Share this article:
    Back to Blog