How to Set Up Claude Code: Install, Configure and Actually Use It
Learn how to install, configure, and use Claude Code CLI with step‑by‑step instructions for authentication, initialization, settings, and testing.
Before you start: versions, package names and storage identifiers change over time. Check the commands against the official documentation for your setup before running them, especially anything that creates, deletes or overwrites data.
This guide takes you from nothing installed to a working Claude Code session with project instructions in place. It should take about ten minutes, most of which is the login.
One correction up front, because it circulates widely and an earlier version of this article repeated it: Claude Code is not a Python package. There is no pip install, no PyPI release and no virtual environment involved. It ships as a native binary. If a guide tells you to check python3 --version first, it is describing a tool that does not exist.
Requirements
- OS: macOS 13.0+, Windows 10 1809+ or Windows Server 2019+, Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+
- Hardware: 4 GB+ RAM, x64 or ARM64
- Shell: Bash, Zsh, PowerShell or CMD
- Account: a Pro, Max, Team, Enterprise or Console account. The free claude.ai plan does not include Claude Code access.
- Network: an internet connection; the tool is not usable offline
Step 1: Install
The native installer is the recommended route on every platform.
macOS, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Windows CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Mixing up the last two is the single most common install error on Windows. Your prompt shows PS C:\ in PowerShell and C:\ without the PS in CMD. If you see The token '&&' is not a valid statement separator, you are in PowerShell; if you see 'irm' is not recognized, you are in CMD.
There are package-manager alternatives — brew install --cask claude-code, winget install Anthropic.ClaudeCode, and signed apt/dnf/apk repositories. They all work, with one trade-off worth knowing before you choose: native installs auto-update in the background; Homebrew, WinGet and Linux package installs do not. With those you run the upgrade yourself.
Step 2: Verify
claude --version
A working installation prints something like 2.1.211 (Claude Code).
If you get command not found instead, the install succeeded but the directory is not on your PATH — that is a separate, quick fix covered in our guide to fixing claude: command not found.
For a fuller picture, run:
claude doctor
It prints read-only diagnostics without starting a session: install health, settings-file validation errors, and warnings with suggested fixes.
Step 3: Log in
Run claude and follow the browser prompts. That is the whole flow for a normal desktop install.
The one variation: if the ANTHROPIC_API_KEY environment variable is set, Claude Code prompts you once to approve that key instead of opening a browser. This is what makes headless servers workable, and it is the route to use if there is no browser on the machine.
Step 4: Windows — native or WSL?
If you are on Windows, this choice is worth thirty seconds now rather than a reinstall later:
| Option | Requires | Sandboxing | Use when |
|---|---|---|---|
| Native Windows | Nothing; Git for Windows optional | Not supported | Your projects and tools are Windows-native |
| WSL 2 | WSL 2 enabled | Supported | You use Linux toolchains, or want sandboxed command execution |
| WSL 1 | WSL 1 enabled | Not supported | WSL 2 is unavailable to you |
On native Windows, installing Git for Windows is optional but recommended: it gives Claude Code Git Bash for the Bash tool. Without it, Claude Code uses PowerShell for shell commands instead. If Git Bash is installed somewhere unusual and Claude Code cannot find it, point at it in your settings file:
{
"env": {
"CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
}
}
Step 5: Give the project instructions with CLAUDE.md
Every session starts with a fresh context window. A CLAUDE.md file is how you stop re-explaining your project each time.
The fastest start is to let it write the first draft. Inside a session, run:
/init
Claude analyzes the codebase and generates a starting CLAUDE.md with build commands, test instructions and conventions it discovers. If one already exists, /init suggests improvements instead of overwriting it.
Three locations, three audiences:
| File | Holds | Shared with |
|---|---|---|
~/.claude/CLAUDE.md |
Personal preferences across all your projects | Just you, everywhere |
./CLAUDE.md or ./.claude/CLAUDE.md |
Project architecture, standards, workflows | Your team, via source control |
./CLAUDE.local.md |
Personal project notes — sandbox URLs, test data | Just you, this project (gitignore it) |
Files are loaded from your working directory and every directory above it, and concatenated rather than overriding each other — ordered from the filesystem root down, so instructions closest to where you launched are read last. Files in subdirectories load on demand, when Claude actually reads files there.
To confirm what loaded, run /context in a session and look under Memory files. That check is worth knowing: “Claude is ignoring my instructions” is usually “the file never loaded”.
One thing to be realistic about: CLAUDE.md is context, not enforced configuration. Claude treats it as instructions to follow, not rules it cannot break. If you need to block an action outright, that is what a PreToolUse hook is for.
Step 6: Settings, briefly
Run /config to change options from a menu — theme, model, editor mode. Claude Code writes most of these to ~/.claude/settings.json.
Which file a setting belongs in decides who it applies to, and that hierarchy has a few sharp edges (a committed project file beats your personal one). We cover it properly in where the Claude Code config files live and how they take precedence.
Frequently asked
Is it free? No. It requires a Pro, Max, Team, Enterprise or Console account, or a third-party provider such as Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry. The free claude.ai plan does not include it.
Does it work offline? No. An internet connection is a stated requirement.
Do I need Node.js? No. Even the npm package installs a native binary that does not invoke Node at runtime.
Can I avoid the terminal entirely? Yes — there is a desktop app for macOS, Windows and Linux.
Sources
- Claude Code docs — Advanced setup (requirements, install commands, Windows options, updates)
- Claude Code docs — How Claude remembers your project (CLAUDE.md locations and load order,
/init) - Claude Code docs — Settings files and precedence
- Claude Code docs — Troubleshoot installation and login
Related reading
Some links on this page may be affiliate links. If you buy through them we may earn a commission at no extra cost to you. See our affiliate disclosure.