How to Install and Use Claude Code CLI: Login, Commands, and PATH Troubleshooting

Learn how to install Claude Code CLI on Windows, macOS, and Linux. Follow login steps, fix PATH / command not found errors, explore essential commands, and use Claude Code safely with Git.

How to Install and Use Claude Code CLI: Login, Commands, and PATH Troubleshooting

Claude Code CLI fails most often at setup—not mid-refactor. If <code>claude</code> is missing from PATH, or login never finishes, everyday prompts never start. This guide covers Native Install (recommended), terminal authentication, essential commands, Windows <code>command not found</code> recovery, and safe Git usage. Follow Claude Code Quickstart for the current official flow, and keep Commands plus Troubleshooting handy when something breaks. Claude Code is available through eligible Claude subscriptions, Claude Console API access, and supported cloud providers. The free Claude chat plan does not include Claude Code access—confirm current plans and limits on Anthropic pricing before you choose an account.

Pricing Plans Screenshot

What is Claude Code CLI?

Claude Code is Anthropic’s agentic coding tool for the terminal: it reads your project, edits files, runs commands, and works with Git. This article focuses on the CLI install and day-one workflow—not a multi-tool benchmark.

Best fit: developers who already live in a shell and want repo-local assistance with reviewable diffs. If you only need chat in a browser, Claude Code CLI is the wrong product surface.

Infographic: How to install Claude Code without PATH errors

Claude Code requirements and access

Before install day, confirm you have a terminal, a project folder, and an eligible account. Official Quickstart lists Claude Pro, Max, Ultra, Team, or Enterprise; Claude Console (API credits); or supported cloud providers such as Bedrock / Azure-oriented paths.

Do not confuse Claude’s free Try Claude / free chat plan with Claude Code access. The free Claude chat plan does not include Claude Code. If your org manages seats, finish Entra / admin provisioning before blaming PATH for a login failure. Verify live entitlements on anthropic.com/pricing.

Access pathWhat it unlocksCheck first
Claude Pro / Max / Ultra / Team / EnterpriseClaude Code via subscriptionSeat is active for your user
Claude Console APICLI via prepaid API creditsConsole account + billing ready
Supported cloud providersEnterprise-routed Claude CodeAdmin gateway / cloud config
Free Claude chat planChat only — not Claude CodeUpgrade or use Console / cloud

How to install Claude Code (Native Install recommended)

Anthropic’s Quickstart marks Native Install as recommended. Prefer these commands over outdated global npm tutorials. After install, open a new terminal and run <code>claude –version</code>.

<strong>macOS / Linux / WSL:</strong><br><pre>curl -fsSL https://claude.ai/install.sh | bash</pre>

<strong>Windows PowerShell</strong> (prompt shows <code>PS C:\</code>):<br><pre>irm https://claude.ai/install.ps1 | iex</pre>

<strong>Windows CMD</strong> (prompt shows <code>C:\</code> without PS):<br><pre>curl -fsSL https://claude.ai/install.cmd -o install.cmd &amp;&amp; install.cmd &amp;&amp; del install.cmd</pre>

Alternatives when Native Install is blocked: <code>brew install –cask claude-code</code> or <code>winget install Anthropic.ClaudeCode</code>. Homebrew and WinGet installs do not auto-update—upgrade periodically. Treat legacy <code>npm install -g @anthropic-ai/claude-code</code> as a compatibility path only, not the default recommendation. Full variants live in Quickstart and release notes on GitHub.

Confirm the install

Run <code>claude –version</code>. A working install prints a version number (often with <code>(Claude Code)</code>). If the shell says the command is not found, fix PATH before login.

How to fix PATH / command not found (Windows walkthrough)

Scenario: Windows user installs Claude Code, types <code>claude</code>, and sees <code>command not found</code> / not recognized. That almost always means PATH—not a failed download.

StepCommand / actionPass criteria
1. New shellClose the old terminal; open a fresh PowerShell or CMDSession started after install finished
2. Locate binary<code>where claude</code> (CMD/PowerShell) or re-check install output pathA real path is printed
3. Inspect PATH<code>echo %PATH%</code> (CMD) / <code>$env:PATH</code> (PowerShell)Install directory appears in PATH
4. Fix + retestAdd the install directory to User PATH; open another new shell; <code>claude –version</code>Version prints without errors
5. IDE terminalsFully quit/reopen VS Code / JetBrains so nested terminals reload envIDE shell resolves <code>claude</code> too

Shell mix-ups that look like PATH bugs

If PowerShell rejects <code>&amp;&amp;</code>, you used a CMD snippet in PowerShell. If CMD rejects <code>irm</code>, you used a PowerShell snippet in CMD. Match the installer to the shell, then retry. See Troubleshooting for install error mapping.

How to log in to Claude Code

From a project directory: <pre>cd /path/to/your/project claude</pre> On first launch, complete the browser / account prompts. Subscription and Console logins are both supported; cloud-gateway orgs may open SSO instead. Store credentials via the product flow—don’t paste tokens from chat screenshots.

Inside a running session, use <code>/login</code> to switch accounts or re-authenticate. If the browser succeeds but the terminal still looks logged out, keep the waiting CLI process open until the callback returns, then send a trivial prompt to confirm the session.

Product Homepage Screenshot

Essential Claude Code CLI commands

Use a real command cheatsheet—not only workflow stories. Shell commands run in your terminal; slash commands run inside Claude Code after it starts. Full lists: CLI reference and Commands.

CommandWherePurpose
`claude`ShellStart interactive Claude Code
`claude –version`ShellVerify install / PATH
`claude -p “query”`ShellOne-off query then exit
`/help`SessionList available commands
`/login`SessionLog in or re-authenticate
`/resume`SessionResume a previous conversation
`/doctor`SessionCheck install/config issues when available
`/clear`SessionStart a fresh conversation

How to use Claude Code with Git safely

Start Claude Code from the repo root so edits land in the right tree. Prefer small diffs: ask for a focused change, inspect <code>git diff</code>, run tests/linters, then commit. Use a feature branch for risky refactors.

Useful prompts once the CLI is healthy: ask what changed, request a descriptive commit message, or create a named branch. Claude Code assists Git—it does not replace review or rollback discipline.

Is Claude Code CLI worth using? Pros, cons, and best use cases

This section is editorial analysis based on official docs and common CLI workflows—not an independent performance lab or competitor bake-off.

<strong>Pros:</strong> terminal-native loop, strong repo orientation, clear install/login documentation, integrates with everyday Git habits.

<strong>Cons / limits:</strong> requires eligible paid/API/cloud access (not free chat); PATH and shell mismatches still dominate first-hour failures; teams need shared runbooks for install + identity.

<strong>Best use cases:</strong> solo or small teams already in the terminal who want assisted edits with human review. Skip if you only need browser chat or lack an eligible account.

Research Methodology

This article synthesizes Anthropic’s official Claude Code Quickstart, Commands, Troubleshooting, CLI reference, product, and pricing pages (verified November 2026). It explains install and login patterns readers can re-check against primary sources.

Recommendations follow documented product behavior. They should not be read as independently measured latency/ROI scores or a multi-week production benchmark.

Support Page Screenshot

FAQ

01

Can I use Claude Code on the free Claude plan?

No. The free Claude chat plan does not include Claude Code. Use an eligible Claude subscription, Claude Console API access, or a supported cloud provider. Confirm current entitlements onAnthropic pricing.
02

How do I install Claude Code on Windows, macOS, or Linux?

Prefer Native Install from Quickstart: <code>curl -fsSL https://claude.ai/install.sh | bash</code> on macOS/Linux/WSL; <code>irm https://claude.ai/install.ps1 | iex</code> in Windows PowerShell; or the CMD install.cmd flow. Then run <code>claude –version</code> in a new terminal.
03

Why is Claude Code command not found after install?

The shell cannot see the binary on PATH. Open a new terminal, locate the install directory, add it to User PATH, retest with <code>claude –version</code>. Fully restart IDE terminals if they still fail.
04

How do I log in to Claude Code CLI?

Run <code>claude</code> in your project directory and complete the browser or account prompts. Use <code>/login</code> inside a session to switch accounts. Keep the CLI process open until the callback finishes.
05

What are the essential Claude Code CLI commands?

Shell: <code>claude</code>, <code>claude –version</code>, <code>claude -p “query”</code>. Session: <code>/help</code>, <code>/login</code>, <code>/resume</code>, <code>/doctor</code>, <code>/clear</code>. SeeCommandsfor the full list.
06

Should I still use npm to install Claude Code?

Native Install is the recommended path. Use Homebrew or WinGet when that fits your environment. Treat npm global installs as legacy/compatibility unless your org standardizes on them.