Anthropic · Setup guide
How to set up Claude Code
Install Claude Code beside the editor you already use, authenticate once, and start with a read-only repository explanation before asking for a patch. Written for first-time terminal users as well as experienced developers.
Claude Code
terminal · checked October 2, 2026
The “Open Claude Code” link goes to the vendor site. It is not an affiliate-tracked link on this page — no commission is claimed for that click. Affiliate disclosure.
Critical: finish install before closing the window
Keep the installer terminal open until you see a success message. If you used an admin window, do not close it until verification works. Then open a new Terminal or PowerShell window and run the verify step — PATH updates rarely apply to shells that were already open, especially on Windows.
Before you begin
- macOS, Linux, WSL or native Windows PowerShell; use WSL2 for sandboxing on Windows.
- A terminal and a project directory you can safely inspect.
- Git for Windows is optional: it enables Bash; without it, native Windows uses the PowerShell tool.
- A Claude subscription or Anthropic Console account for sign-in.
Authentication
Browser sign-in on first launch
Account: Claude Pro/Max/Team/Enterprise or Anthropic Console access
Free Claude.ai does not include Claude Code. If ANTHROPIC_API_KEY is set, usage can bill API credits instead of your subscription — prefer subscription login for plan-included usage.
Install or open it
1. Get the harness ready
These steps are written for beginners. On Mac, Terminal is the black/white text window where you type commands. On Windows, use PowerShell or Terminal. Use the OS tabs to hide steps that are not for your computer, then copy one command at a time.
- 01
Open Terminal on a Mac
MacClick the Spotlight search icon (magnifying glass) at the top-right of the menu bar, or press Command (⌘) + Space. Type Terminal and press Return. A text window opens — that is where you paste the install commands below. Leave it open.
- 02
Open Terminal or PowerShell on Windows
WindowsPress the Windows key, type Terminal or PowerShell, then press Enter. Use that window for the commands below. If Windows asks for permission to run a script or install software, read the prompt before approving.
- 03
How to paste a command
Copy one command at a time from this page. Click inside the terminal window, paste (Mac: ⌘+V, Windows: Ctrl+V or right-click → Paste), then press Return / Enter. Wait until the prompt comes back before running the next command. You do not need to type the leading $ if you see one in other docs.
- 04
Do not close the installer until verified
Keep the installer terminal (or admin PowerShell) open until the install finishes without errors. Closing early can leave a half-written binary or an incomplete PATH update — especially on Windows.
- 05
Open a new terminal after installers
PATH updates often only apply to new shells — especially on Windows. Do not close the install session until the installer finishes, then open a fresh Terminal/PowerShell before running --version checks.
- 06
Inspect before you pipe an installer
Commands like curl … | bash download and run a script immediately. Prefer the official package manager when offered. If you use a curl installer, you can download the script first, open it in a text editor, then run it — never paste installers from random blogs.
- 07
Install on a Mac (Homebrew)
MacThe stable Homebrew cask typically follows the latest release by about a week and does not auto-update by default. Homebrew/WinGet can opt in with CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1. Upgrade through Homebrew; use the native installer below for automatic updates, subject to your update settings.
bashbrew install --cask claude-codeYou should see: The installer finishes without an error. Open a new terminal before the verify step so PATH updates apply.
Claude Code setupIf this fails
- The install command errors, or the next verify step says “command not found”. Re-run the official install command with network access, then open a brand-new terminal window before verifying.
- 08
Install on Windows (WinGet)
WindowsOpen a new terminal afterwards so PATH updates. WinGet installs require manual upgrades by default (package-manager auto-update can be enabled explicitly); the native PowerShell installer supports automatic updates. Git for Windows is optional and enables Bash; otherwise Claude uses PowerShell.
powershellwinget install Anthropic.ClaudeCodeYou should see: The installer finishes without an error. Open a new terminal before the verify step so PATH updates apply.
Claude Code setupIf this fails
- The install command errors, or the next verify step says “command not found”. Re-run the official install command with network access, then open a brand-new terminal window before verifying.
- 09
Native installer (Mac / Linux / WSL, auto-updates)
Documented under Advanced installation options, and the usual path on Linux or WSL (apt, dnf and apk packages also exist). The native installer puts Claude Code under your home directory (often ~/.local/bin), keeps itself updated, and does not need sudo — if a guide tells you to sudo the installer, ignore it.
bashcurl -fsSL https://claude.ai/install.sh | bashYou should see: The installer finishes without an error. Open a new terminal before the verify step so PATH updates apply.
Claude Code setupIf this fails
- The install command errors, or the next verify step says “command not found”. Re-run the official install command with network access, then open a brand-new terminal window before verifying.
- 10
Native installer on Windows (PowerShell, auto-updates)
WindowsAlternative to WinGet. Do not run the Mac/Linux install.sh from Git Bash — it rejects that environment. In PowerShell, paste the official Windows installer, then open a new terminal so PATH updates.
powershellirm https://claude.ai/install.ps1 | iexYou should see: The installer finishes without an error. Open a new terminal before the verify step so PATH updates apply.
Claude Code setupIf this fails
- The install command errors, or the next verify step says “command not found”. Re-run the official install command with network access, then open a brand-new terminal window before verifying.
- 11
Verify the command
Close Terminal and open a new window. If you see a version number, install worked. If you see “command not found”, confirm ~/.local/bin (or %USERPROFILE%\.local\bin) is on PATH, or run claude doctor.
bashclaude --versionYou should see: A version number. If you see “command not found”, open a new terminal and check PATH (or run claude doctor).
Claude Code quickstartIf this fails
- The shell cannot find claude after installation. Open a new terminal, confirm ~/.local/bin or %USERPROFILE%\.local\bin is on PATH, then run claude --version or claude doctor.
- 12
Other surfaces (Desktop and VS Code)
This page is the CLI path. Claude Code also ships a Desktop app and a VS Code / Cursor extension — follow Anthropic’s current docs rather than unofficial installers: https://code.claude.com/docs/en/desktop and https://code.claude.com/docs/en/vs-code.
Claude Code Desktop
Repository or project
2. Start in the right place
Keep the first repository small, clean, and easy to roll back while you learn the harness’s permissions and context model.
- 01
Open the repository
Start in a clean working tree or a disposable branch so the first run is easy to review.
bashcd path/to/your-repositoryYou should see: The prompt shows you are inside the intended folder (check with `pwd`).
If this fails
- “No such file or directory” or you are still in your home folder. Create or clone the practice folder first, then `cd` into it before starting the tool.
- 02
Start a session
Run Claude Code from the repository root and complete the sign-in prompt. For a safe first pass on a new codebase, Shift+Tab to Manual or Plan before broader edits.
bashclaudeYou should see: The tool starts in this folder and waits for your first prompt (or shows a short first-run / sign-in screen).
If this fails
- Nothing happens, or you land in the wrong folder. Confirm you are inside the practice repo (`pwd`), that you signed in, and that you opened a new terminal after install.
First run
Ask for a map before a modification
Use this task to test the workflow before handing over a larger repository or production responsibility.
- 01Shift+Tab to Manual or Plan for the first orientation and ask: explain this repository’s main entry points, test command, and deployment boundary.
- 02Do not edit files or run commands that change state until you have reviewed the map.
- 03Ask the agent to identify three files worth reading next.
Why this is safe: Auto is safer than skipping permissions entirely, but a read-first Manual/Plan pass still verifies understanding before write or shell work.
Stop and review if
- The agent proposes deleting, migrating, or rewriting files before explaining the plan.
- The repository contains secrets or production credentials in the working tree.
- The tool asks for broader permissions than the task requires.
The operating boundary
Privacy, data, and cost
The setup is incomplete until you know what the harness can see, what account pays for it, and who approves a risky action.
Privacy
Consumer Pro/Max data can be used for training when that setting is enabled. Commercial Team/Enterprise/API data is not used to train generative models unless voluntarily provided for improvement. Inference still sends prompts and repository context. Local session transcripts are plaintext under ~/.claude/projects/ and normally retained 30 days; Desktop/Cowork sessions are exempt from that cleanup default. See https://code.claude.com/docs/en/data-usage.
Training on code: tier dependent
Qualified Enterprise ZDR requires separate Anthropic enablement and covers direct Claude Code inference, not claude.ai chat, Cowork, third-party MCP services or all administrative data. Legal/misuse exceptions and model-specific restrictions still apply: https://code.claude.com/docs/en/zero-data-retention.
Sensitive repos: Use a sanitized clone for the first run, remove secrets, and confirm the organisation policy before connecting a sensitive repository.
Pricing
Pro/Max/Team/Enterprise subscription access and Anthropic Console/API billing are separate paths. Pro is $20/month or $200 billed yearly; Max is $100/$200 monthly; Team Standard $25 monthly/$20 annual per seat and Premium $125/$100; Enterprise $20 per seat with annual billing plus API-rate usage. Account, organisation, provider and version determine model selection: default clears an override, while current Anthropic API opus/sonnet aliases select Opus 5.5/Sonnet 5.5. Neither Fable model is an account-type default. Check /model and https://code.claude.com/docs/en/model-config.
Model: hybrid
Watch out: Long loops consume shared subscription allowance or API/usage credits. API credentials can select separate billing. Fable uses usage credits on Pro; on Max it can use up to half the regular weekly allowance before further Fable work needs credits; non-interactive -p usage can bill credits without the interactive consent prompt. Fable requires retention by default and its availability under ZDR is governed by separate Covered Models policy. Check account billing and organisation eligibility before automation.
When setup goes wrong
The shell cannot find claude after installation.
Open a new terminal, confirm ~/.local/bin or %USERPROFILE%\.local\bin is on PATH, then run claude --version or claude doctor.
The first session opens the wrong account or bills API credits.
Inspect claude auth status and the active credential configuration first. If you deliberately choose to switch accounts, current CLI commands are claude auth logout and claude auth login. Remove an unintended API-key override from this session only after confirming the intended billing path; preserve other applications’ credentials.
A gateway rejects requests or receives traffic you did not expect.
Use a gateway supporting Anthropic Messages format and verify its model IDs and billing. CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 disables documented nonessential traffic; it does not guarantee an air-gapped session or fix every provider error. See https://code.claude.com/docs/en/llm-gateway and https://code.claude.com/docs/en/data-usage.
The agent wants to make a broad change immediately.
Shift+Tab to Manual or Plan, ask for a plan and file list, then restart from a clean branch with narrower permissions.
You need a sandbox on Windows.
Use WSL2; native Windows and WSL1 do not support Claude Code sandboxing. Enable the sandbox explicitly and check its status. It covers shell execution, while file tools, MCP servers and hooks are outside that boundary: https://code.claude.com/docs/en/sandboxing.
Next steps
After the first successful run
Keep the pilot small, then compare surfaces and budget before a team rollout.
Setup details change quickly. The page was checked October 2, 2026; use the official source below before installing in a managed or production environment.