Skip to main content

How to Install Claude Code: Complete Setup Guide for Every Platform (2026)

A
25 min readClaude AI Tutorials

Claude Code installs with a single command on macOS, Windows, and Linux using the native installer — no Node.js required. You need a Claude Pro plan ($20/month) or higher to use it. This guide covers every installation method, platform-specific steps, security warnings about fake installers, and fixes for the most common problems.

How to Install Claude Code: Complete Setup Guide for Every Platform (2026)

Claude Code is Anthropic's official command-line interface that brings AI coding assistance directly into your terminal. Unlike browser-based tools, it reads your entire codebase, executes commands, and handles complex multi-file edits through natural language — all without leaving the command line. As of March 2026, the recommended installation method is the native installer, which requires no dependencies and updates automatically. You need at least a Claude Pro subscription ($20/month) to authenticate and use Claude Code, since the free tier does not include CLI access.

TL;DR

Here is everything you need to know about installing Claude Code, condensed into the essential facts. On macOS or Linux, open your terminal and run curl -fsSL https://claude.ai/install.sh | bash — the entire process takes under two minutes. Windows users should install Git for Windows first, then run irm https://claude.ai/install.ps1 | iex in PowerShell. The native installer is the officially recommended method because it requires no Node.js, updates automatically, and provides the most stable experience. Homebrew (brew install --cask claude-code) and WinGet (winget install Anthropic.ClaudeCode) are supported alternatives for developers who prefer package managers. The old npm installation method (npm install -g @anthropic-ai/claude-code) is now deprecated — if you are still using it, Anthropic recommends migrating to the native installer. Claude Code requires a paid Claude account: the Pro plan starts at $20/month ($17/month with annual billing), while the Max plan at $100/month offers 20x more usage. The free plan does not include Claude Code access. After installing, run claude in any project directory to start an interactive coding session where you can ask Claude to read, edit, and manage your code through conversation.

What Is Claude Code and Do You Really Need It?

Claude Code is not just another AI code completion tool — it is a full agentic coding environment that runs entirely in your terminal. Launched by Anthropic and reaching general availability in May 2025, Claude Code understands your entire project structure, can navigate between files, run tests, commit changes, and even debug complex issues across multiple codebases simultaneously. What makes it fundamentally different from tools like GitHub Copilot or Cursor is that Claude Code operates as an autonomous agent: you describe what you want in plain English, and it plans, executes, and verifies the changes without requiring you to manually select code or switch between files. It works with any language, any framework, and any editor — because it does not need an editor at all.

The question of whether you actually need Claude Code depends on your workflow and how much time you spend in the terminal. If you are a developer who already works heavily with command-line tools, Claude Code fits naturally into your existing process. It excels at tasks that typically require touching many files at once: refactoring a module across your entire codebase, implementing a feature that spans frontend and backend, or debugging an issue that involves tracing through multiple layers of your application. For developers evaluating AI coding tools, you may want to read our comprehensive comparison between ChatGPT and Claude to understand how Claude's underlying models stack up against the competition. If your work is primarily in a single file at a time, a traditional inline code assistant might be sufficient, but for complex, multi-file engineering tasks, Claude Code represents a significant step forward in developer productivity. The tool has found particularly strong adoption among backend developers, full-stack engineers, and DevOps professionals who regularly work across multiple services and configuration files. Early adopters on Reddit and developer forums consistently highlight that Claude Code's ability to understand project context — reading README files, analyzing dependency graphs, and understanding test patterns — makes it dramatically more useful than AI assistants that only see individual files in isolation. The fact that it runs in the terminal also means it integrates seamlessly with existing developer workflows involving git, docker, make, and other command-line tools without requiring any editor plugins or configuration.

What You Need Before Installing Claude Code

Claude Code pricing plans comparison showing Free, Pro, Max, and Teams tiers

Before you run the install command, there are two things you need to sort out: your system requirements and your Claude subscription. Getting these right upfront saves you from the frustration of installing Claude Code only to discover you cannot authenticate or that your operating system is not supported. This is the step most installation guides skip, and it is the reason many developers hit a wall immediately after installation.

System requirements are straightforward but vary by platform. On macOS, you need version 13.0 (Ventura) or later — older versions of macOS are not supported by the native installer (code.claude.com/docs/en/setup, verified March 2026). Windows users need Windows 10 version 1809 or later, or Windows Server 2019+, and crucially, you must have Git for Windows installed before running the Claude Code installer. This Git dependency is the single most common source of installation failures on Windows, so install it from git-scm.com before attempting anything else. Linux users need Ubuntu 20.04+, Debian 10+, or Alpine 3.19+ (Alpine requires additional dependencies). All platforms require a minimum of 4GB RAM, though 8GB or more is recommended for working with larger codebases. The supported shells are Bash, Zsh, PowerShell, and CMD.

Pricing is the part that catches people off guard. Claude Code itself is free to install — the binary costs nothing. However, to actually use it, you must authenticate with a Claude account that includes Claude Code access. The free Claude plan ($0/month) does not include Claude Code at all (claude.com/pricing, March 2026). The Pro plan at $20/month ($17/month with annual billing) is the minimum tier that includes Claude Code, and it is what most individual developers should choose. If you need significantly more usage, the Max plan at $100/month (or $200/month for the 5x tier) provides 20x more capacity and additional features like extended thinking and research capabilities. For teams, the Teams Premium plan at $150/user/month includes Claude Code, but the standard Teams plan at approximately $25/user/month does not. You can explore Claude Pro free trial options to test the service before committing, or check our detailed Claude subscription pricing breakdown for a full comparison. Developers who prefer pay-per-use billing can also authenticate Claude Code with an Anthropic API key instead of a subscription, which charges based on actual token consumption. For developers already working with AI APIs, platforms like laozhang.ai offer aggregated API access across multiple models, which can be a cost-effective alternative for programmatic usage.

How to Install Claude Code (Step by Step)

Step-by-step installation guide for Claude Code on macOS, Windows, and Linux platforms

This is the core of the guide — the actual commands you need to run, organized by platform. The native installer is the recommended approach for all platforms because it bundles everything Claude Code needs without requiring you to install Node.js or manage npm packages. Each method below has been verified against the official documentation at code.claude.com as of March 2026.

macOS and Linux (Including WSL)

Installing Claude Code on macOS or Linux is genuinely a one-command process that takes about two minutes from start to finish. Open your terminal — on macOS you can press Cmd+Space, type "Terminal", and press Enter, while on Linux you can use Ctrl+Alt+T or your preferred terminal emulator. Then run the following command:

bash
curl -fsSL https://claude.ai/install.sh | bash

This downloads and runs the official installer script, which detects your operating system and architecture automatically, downloads the appropriate binary, and places it in your system PATH. Once the installation completes, you will see a success message. Verify the installation by running claude --version, which should display the current version number (something like claude v1.0.33 (stable) or similar). If you are using WSL (Windows Subsystem for Linux), the process is identical — open your WSL terminal and run the same curl command. The installer treats WSL as a Linux environment, so there are no special steps required. After verification, simply type claude in any project directory to launch an interactive session and start using AI-powered coding assistance.

Windows Installation

Windows installation requires one extra step compared to macOS and Linux: you must install Git for Windows before running the Claude Code installer. This is not optional — the installer will fail without it, and this requirement catches many users off guard since it is not prominently mentioned in every guide. Download Git for Windows from git-scm.com/download/win, run the installer with the default settings, and make sure to restart your terminal after installation so that Git is available in your PATH.

Once Git is installed, you have two options for installing Claude Code on Windows. The recommended method uses PowerShell — open PowerShell (you can right-click the Start button and select "Windows PowerShell" or "Terminal"), then run:

powershell
irm https://claude.ai/install.ps1 | iex

If you prefer the traditional Command Prompt (CMD), use this alternative command instead:

cmd
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Both commands achieve the same result: they download the official installer, extract the Claude Code binary, and configure your PATH. The PowerShell method is slightly cleaner since it does not leave a temporary file. After installation, verify with claude --version in a new terminal window. If the command is not recognized, you may need to close and reopen your terminal to refresh the PATH environment variable. A common gotcha on Windows is that some developers try to use Git Bash (the Bash emulator that comes with Git for Windows) to run the curl-based macOS/Linux installer — while this sometimes works, it is not the recommended approach. Stick with the PowerShell or CMD method for the most reliable Windows experience. If you are using WSL on Windows, you should install within the WSL environment using the Linux curl command rather than the Windows PowerShell installer, since WSL maintains its own separate filesystem and PATH configuration.

Package Manager Alternatives (Homebrew and WinGet)

For developers who prefer managing all their tools through a package manager, Claude Code is available through Homebrew on macOS and WinGet on Windows. On macOS, simply run brew install --cask claude-code — this installs Claude Code as a Homebrew cask, which means updates are managed through brew upgrade rather than the built-in auto-updater. On Windows, you can use winget install Anthropic.ClaudeCode to install through the Windows Package Manager. Both package manager methods provide the same Claude Code binary as the native installer, and they handle PATH configuration automatically. The trade-off is that you are managing updates through your package manager rather than through Claude Code's built-in update mechanism, which some developers prefer for consistency across their toolchain while others find less convenient for staying on the latest version.

Native Installer vs Homebrew vs npm: Which Should You Choose?

Comparison chart showing Native Installer, Homebrew, and npm installation methods for Claude Code

With three different installation methods available (plus WinGet for Windows), choosing the right one can feel overwhelming. The reality is simpler than it looks: for the vast majority of users, the native installer is the correct choice, and Anthropic's own documentation explicitly recommends it. The native installer requires no runtime dependencies like Node.js, includes automatic updates so you are always on the latest version, and provides the most stable experience because it is the primary method Anthropic tests and supports. It works on every platform — macOS, Windows, Linux, and WSL — through a single installation command specific to your OS.

Homebrew and WinGet are good alternatives if you have a strong preference for managing all your development tools through a unified package manager. Many experienced developers maintain their entire toolchain through brew or winget commands, and using these for Claude Code keeps your workflow consistent. The trade-off is that updates are not automatic — you need to explicitly run brew upgrade or winget upgrade to get new versions, which means you might lag behind the latest features and bug fixes. For enterprise environments where controlled rollouts matter, this can actually be an advantage, since you choose when to update rather than having updates pushed automatically.

Understanding why the native installer is so strongly recommended helps contextualize the other options. Anthropic designed the native installer to be self-contained: it does not rely on any system-level package manager or runtime environment, which eliminates an entire category of installation problems related to dependency conflicts, version mismatches, and PATH pollution. The binary it installs is statically compiled for your specific platform and architecture, meaning it starts faster and runs more reliably than the npm-based version, which required the Node.js runtime to execute. The automatic update mechanism checks for new versions each time you launch Claude Code and seamlessly applies updates in the background, ensuring you always have access to the latest model improvements and bug fixes without any manual intervention.

The npm method (npm install -g @anthropic-ai/claude-code) still works but is officially deprecated as of the current documentation (code.claude.com, March 2026). If you installed Claude Code through npm previously, it will continue to function, but Anthropic recommends migrating to the native installer for better performance, stability, and automatic updates. The npm method also requires Node.js 18 or later to be installed on your system, which is an unnecessary dependency for a tool that does not actually need Node.js to run. If you are currently using the npm installation, the migration is straightforward: uninstall the npm package with npm uninstall -g @anthropic-ai/claude-code, then install the native version using the curl or PowerShell command for your platform. Your configuration and settings will be preserved since they are stored in your home directory, not in the npm package location.

Your First 5 Minutes with Claude Code

After installation, the transition from "installed" to "productive" should be immediate, and that is exactly what Claude Code is designed for. The very first time you run claude in your terminal, you will be guided through an authentication flow that connects the CLI to your Claude account. You will be prompted to log in through your browser, where you will authorize Claude Code to use your Pro, Max, or API credentials. This is a one-time setup — subsequent launches will use your saved authentication.

Once authenticated, the most important thing to understand is that Claude Code is context-aware based on your current working directory. Navigate to a project folder using cd /path/to/your/project before launching Claude, and it will automatically scan and understand your codebase structure. You start an interactive session simply by typing claude with no arguments. From there, you can talk to Claude in natural language: ask it to explain how a particular function works, request that it implement a new feature, tell it to find and fix a bug, or instruct it to refactor a module. Claude Code reads your files, makes edits, creates new files, and can even run terminal commands on your behalf (with your permission). Some particularly useful first commands include claude "explain the architecture of this project" for getting oriented in an unfamiliar codebase, or claude "run the tests and fix any failures" for immediate practical value. You can also use the one-shot mode by passing your request directly as an argument — for example, claude "add input validation to the user registration form" — which executes the task and exits without starting an interactive session, making it perfect for quick fixes or scripted workflows.

Understanding how Claude Code manages permissions is essential for trusting it with your codebase. By default, Claude Code asks for your approval before making any file changes or running shell commands, displaying exactly what it intends to do and waiting for your confirmation. You can adjust this behavior through permission modes: the default mode requires approval for every action, the "acceptEdits" mode automatically approves file edits but still asks about shell commands, and there are more permissive modes for experienced users who want faster execution. This permission system means you never have to worry about Claude Code making unexpected changes — every modification is visible and approved before it happens, giving you the same level of control as if you were making the changes manually while benefiting from AI-assisted speed and accuracy.

Beyond interactive sessions, Claude Code supports several workflow patterns that experienced users rely on daily. You can pipe content directly to Claude with commands like git diff | claude "review this code change" for quick code reviews, or cat error.log | claude "diagnose the root cause of these errors" for rapid debugging. The /init command creates a CLAUDE.md file in your project root that gives Claude persistent context about your project's conventions, coding standards, and important architectural decisions — think of it as a briefing document that makes every subsequent interaction more effective. Experienced users often populate this file with information about their tech stack, testing requirements, and coding style preferences, which dramatically improves the quality and consistency of Claude's suggestions across sessions.

You can also configure Claude Code's behavior through settings, including choosing which release channel to follow (stable vs beta), setting up MCP (Model Context Protocol) servers for extended tool access, and customizing keyboard shortcuts for your preferred terminal environment. The MCP integration is particularly powerful because it allows Claude Code to interact with external tools and services — databases, issue trackers, documentation systems — giving it capabilities that go far beyond simple code editing. For developers already working with AI APIs in their projects, services like laozhang.ai provide aggregated access to multiple AI models through a single API endpoint, which can complement Claude Code's capabilities when you need to integrate AI features directly into your applications.

Fixing the 5 Most Common Installation Problems

Even with a straightforward installation process, things can go wrong — and when they do at the installation stage, it is especially frustrating because you cannot even start using the tool. These are the five problems that appear most frequently in community discussions and support channels, along with their solutions.

"command not found" after installation is the single most common issue, and it almost always comes down to your shell's PATH not being updated. The installer adds Claude Code to your PATH, but your current terminal session may not have picked up the change. The simplest fix is to close your terminal completely and open a new one. If that does not work, check whether the installation added an entry to your shell profile by running cat ~/.bashrc | grep claude (or ~/.zshrc for Zsh users). On Windows, open a new PowerShell window — do not reuse the one where you ran the installer. If the PATH entry is missing entirely, you can manually add the Claude Code binary location to your PATH, which is typically ~/.claude/bin on macOS/Linux.

Git not found on Windows is the second most frequent problem, and it is entirely preventable. The Claude Code installer on Windows depends on Git for Windows being available in your system PATH. If you installed Git but the installer still cannot find it, the most likely cause is that you did not check the "Add Git to PATH" option during the Git installation, or you did not restart your terminal after installing Git. Reinstall Git for Windows, making sure to select the option that adds Git to your system PATH, then restart your terminal before attempting the Claude Code installation again. You can verify that Git is properly configured by running git --version in a new terminal window.

Authentication failures typically occur when your Claude account does not have the required subscription tier. Remember that the free plan does not include Claude Code access — you need at least a Pro subscription ($20/month). If you have a Pro subscription but still cannot authenticate, try clearing your cached credentials by running claude logout followed by claude login to re-initiate the authentication flow. Network issues, particularly corporate firewalls or VPNs that block Anthropic's authentication endpoints, can also cause authentication failures. In those cases, check whether you can access claude.ai in your browser from the same network.

Permission errors during installation happen when the installer cannot write to the target directory or execute the downloaded binary. On macOS and Linux, this usually means you need to adjust permissions on the ~/.claude directory or run the installer with appropriate user permissions. It is important to avoid using sudo for the installation unless absolutely necessary, because running the installer as root creates files owned by root in your home directory, which causes different permission problems later when you try to run Claude Code as your normal user account. If you previously ran the installer with sudo, fix the ownership with sudo chown -R $(whoami) ~/.claude and then try again without sudo. On Windows, running PowerShell as Administrator can resolve most permission-related installation failures — right-click the PowerShell icon and select "Run as administrator" before running the install command. If you are in a corporate environment with restricted write access, endpoint protection software, or application whitelisting policies, you may need to request that your IT team whitelist the Claude Code installation directory and binary.

Version conflicts from old npm installations can cause confusing behavior if you previously had Claude Code installed through npm and then installed the native version. Both versions may exist in your PATH, and your shell might be finding the wrong one. Run which claude (macOS/Linux) or where claude (Windows) to see which binary is being executed. If it points to an npm installation (typically something like /usr/local/bin/claude or a path within your Node.js installation), uninstall the npm version first with npm uninstall -g @anthropic-ai/claude-code, then verify that the native installation is the one being found. The native installer places the binary in ~/.claude/bin/claude on most systems. After removing the npm version, open a new terminal and run which claude again to confirm you are now using the native binary. If both were installed, it is also worth checking that you are not seeing stale cached version information by running claude --version to verify you are on the latest native release.

If you encounter any issue not covered above, the official Claude Code troubleshooting guide at code.claude.com provides additional solutions, and the claude doctor command performs a diagnostic check that identifies common configuration problems automatically. Running claude doctor outputs a detailed report of your system configuration, authentication status, and any detected issues, making it the single best starting point when something goes wrong with your installation.

Staying Safe and Up to Date

Security is not typically the first thing you think about when installing a developer tool, but Claude Code presents a unique case that warrants attention. In 2026, security researchers discovered a campaign where fake Claude Code installation pages were being promoted through Google Ads, distributing malware known as the "InstallFix" attack (reported by BleepingComputer and TechRepublic). These malicious pages looked convincingly like official Anthropic download pages and appeared at the top of search results as paid advertisements. The takeaway is simple but critical: only install Claude Code from official sources. The legitimate installation URLs are claude.ai/install.sh for macOS/Linux, claude.ai/install.ps1 for Windows PowerShell, the official Homebrew cask, the WinGet package Anthropic.ClaudeCode, or the npm package @anthropic-ai/claude-code from the official npm registry. If you reached an installation page through a Google ad or an unfamiliar website, verify the URL carefully before running any commands.

To verify the integrity of your installation after running it, check the version output with claude --version — a legitimate installation will show a clean version string like claude v1.0.33 (stable). If you see anything unusual, unexpected branding, or the binary is located in an unexpected directory (check with which claude on macOS/Linux), remove it immediately and reinstall from the official source. It is also worth noting that Claude Code communicates exclusively with Anthropic's servers for AI processing — it does not send your code to any third-party services, and you can review exactly what data is being transmitted through the tool's transparency features.

Keeping Claude Code updated is straightforward with the native installer, which checks for and applies updates automatically when you launch the tool. You can manually check your current version with claude --version and trigger an update check with claude update. If you installed through Homebrew, run brew upgrade claude-code periodically to stay current. For WinGet installations, use winget upgrade Anthropic.ClaudeCode. Staying on the latest version is important not just for new features, but also for security patches and stability improvements. The Claude Code team ships updates frequently, often multiple times per week, so the automatic update mechanism of the native installer is genuinely valuable for ensuring you always have the latest fixes and capabilities without any manual intervention. You can also choose between the stable and beta release channels through Claude Code's settings — the stable channel is recommended for production work, while the beta channel gives you early access to new features.

Frequently Asked Questions

Is Claude Code free to use?

Claude Code itself is free to install — the binary costs nothing to download. However, you need a paid Claude account to authenticate and actually use it. The minimum requirement is a Claude Pro subscription at $20/month ($17/month with annual billing). The free Claude plan does not include Claude Code access. Alternatively, you can use an Anthropic API key with pay-per-use billing, which charges based on the tokens consumed during your coding sessions rather than a flat monthly fee.

Does Claude Code work offline?

No, Claude Code requires an internet connection to function. It communicates with Anthropic's Claude models in the cloud to process your requests, so you need a stable internet connection during use. Your code itself is processed locally for context, but the AI reasoning happens on Anthropic's servers. The tool does cache some configuration locally, so launching and basic navigation work without connectivity, but any actual AI-powered assistance requires being online.

Can I use Claude Code with VS Code or JetBrains?

Claude Code is a standalone terminal tool and does not require any IDE. However, it works alongside any editor or IDE since it operates in your terminal. Many developers run Claude Code in a split-terminal layout within VS Code's integrated terminal or a separate terminal tab alongside their JetBrains IDE. There are also community-built extensions that integrate Claude Code more deeply with specific editors, though the native terminal experience is the primary supported workflow.

How do I uninstall Claude Code?

The native installer includes a clean uninstall option. Run claude uninstall to remove the binary and its associated files. If you installed through Homebrew, use brew uninstall claude-code. For WinGet, use winget uninstall Anthropic.ClaudeCode. If you installed through npm, use npm uninstall -g @anthropic-ai/claude-code. Your configuration files in ~/.claude/ are preserved by default during uninstallation, so you can reinstall later without losing your settings.

What is the difference between Claude Code and the Claude desktop app?

The Claude desktop app provides a graphical chat interface similar to claude.ai but as a native application on your computer. Claude Code, on the other hand, is a command-line tool specifically designed for software development. Claude Code can read and modify files in your project, run terminal commands, interact with git, and perform multi-file edits — capabilities that the desktop app does not have. Think of the desktop app as a general-purpose AI assistant and Claude Code as a specialized coding partner that lives in your terminal.

How much does Claude Code usage count against my subscription limits?

Claude Code usage does count against your subscription's usage limits. On the Pro plan, you get a generous but finite amount of usage per day, and heavy Claude Code sessions (especially those involving large codebases or many sequential operations) can consume this allocation quickly. The Max plan at $100/month provides roughly 20x the usage capacity of Pro, which is why Anthropic recommends it for developers who use Claude Code extensively throughout their workday. If you hit your usage limit, Claude Code will notify you and you will need to wait for the limit to reset (typically on a rolling window) or upgrade to a higher tier. Using an API key instead of a subscription gives you pay-per-use pricing without hard daily limits, though costs can add up with intensive usage.

Can I use Claude Code in a CI/CD pipeline or automated scripts?

Yes, Claude Code supports non-interactive usage that works well in automated environments. You can pass commands directly as arguments like claude -p "generate unit tests for src/utils.ts" which executes the task and outputs the result without any interactive prompts. For CI/CD integration, you would typically authenticate using an API key stored as an environment variable rather than an interactive browser login. This makes it possible to use Claude Code for automated code reviews, test generation, or documentation updates as part of your build pipeline. The --output-format json flag is particularly useful in scripted contexts because it returns structured output that other tools can parse programmatically.

Get Coding with Claude Code Today

Installing Claude Code takes less than five minutes on any platform, and the native installer makes the process as simple as running a single command. Start by verifying your system meets the requirements (macOS 13+, Windows 10 1809+, or Linux Ubuntu 20.04+), ensure you have a Claude Pro subscription ($20/month minimum) or an Anthropic API key, and run the appropriate installation command for your platform. The native installer is the recommended choice for most users — it handles dependencies automatically, stays updated without manual intervention, and provides the most reliable experience that Anthropic actively tests and supports.

Remember to only download from official sources (claude.ai, code.claude.com, or GitHub anthropics/claude-code) to protect yourself from the malware campaigns that have targeted Claude Code users through fake Google Ads. If you run into issues during installation, the troubleshooting section above covers the five most common problems and their solutions, and the claude doctor command is always available as a diagnostic starting point. Once installed, navigate to your project directory, type claude, and start building — whether that means implementing a new feature, refactoring legacy code, or debugging a tricky issue across your entire codebase. Your terminal just became your most powerful coding tool, and you are now equipped with the knowledge to install, configure, and maintain Claude Code safely and effectively on any platform.

Share:

laozhang.ai

One API, All AI Models

AI Image

Gemini 3 Pro Image

$0.05/img
80% OFF
AI Video

Sora 2 · Veo 3.1

$0.15/video
Async API
AI Chat

GPT · Claude · Gemini

200+ models
Official Price
Served 100K+ developers
|@laozhang_cn|Get $0.1