If you've been looking for a powerful AI coding assistant, Claude Code is making waves in the developer community. This guide walks you through installing Claude Code across different operating systems, from straightforward setups to more advanced configurations.
Whether you're on Windows, Linux, or Mac, getting Claude Code up and running is easier than you might think. Let me show you exactly how to do it.
Claude Code stands out as one of the most capable AI coding tools available today. It can understand complex codebases, suggest intelligent solutions, and even help orchestrate entire development tasks. The best part? It works seamlessly across all major operating systems.
For developers looking to supercharge their coding workflow with AI assistance, 👉 explore AI-powered development tools that integrate seamlessly with your existing setup to enhance productivity without disrupting your current environment.
The most straightforward approach for Windows users is installing Claude Code directly in your native environment. Here's how:
First, you'll need Git installed on your system. Download it from the official Git website and run the installer.
Next, verify that Node.js is installed by opening PowerShell and running:
node -v
npm -v
If these commands don't return version numbers, you'll need to install Node.js. I recommend using nvm (Node Version Manager) to handle different Node versions easily.
Open your Windows System Properties and add these environment variables:
ANTHROPIC_BASE_URL: https://api.aicodemirror.com/api/claudecode
ANTHROPIC_API_KEY: your_api_key_here
ANTHROPIC_AUTH_TOKEN: your_api_key_here
Save these changes and restart PowerShell for them to take effect.
If you have an older version installed, remove it first:
npm uninstall -g @anthropic-ai/claude-code
Then install the official package:
npm install -g @anthropic-ai/claude-code
After installation completes, restart PowerShell and verify everything worked:
claude -v
You should see the version number displayed. Now navigate to your project directory and launch Claude Code:
cd D:/workspace/project
claude
For developers who prefer a Linux environment, WSL offers a robust alternative. This approach gives you the flexibility of Linux while staying on Windows.
Open Control Panel and navigate to "Turn Windows features on or off." Enable both "Windows Subsystem for Linux" and "Virtual Machine Platform." Restart your computer.
After reboot, open Terminal as administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart again, then update WSL:
wsl --update
wsl --set-default-version 2
If you don't have a Linux distribution yet, simply run:
wsl --install
This automatically installs Ubuntu and configures WSL2 as default.
Launch your WSL environment and run the environment check script:
curl -fsSL https://download.aicodemirror.com/env_deploy/env-install.sh | bash
Remove any existing Claude Code installation:
npm uninstall -g @anthropic-ai/claude-code
Install the official package:
npm install -g @anthropic-ai/claude-code
Configure your API credentials by running:
sudo apt-get install jq
curl -fsSL https://download.aicodemirror.com/env_deploy/env-deploy.sh | bash -s -- "your_api_key"
Restart your terminal, navigate to your project directory, and start coding:
cd /mnt/d/workspace/project
claude
For developers who want complete environment isolation, Docker provides an excellent solution. This method keeps Claude Code and all its dependencies neatly contained.
Download Docker Desktop from the official website and install it. During installation, make sure "Use WSL 2 based engine" is checked.
Configure Docker to work with WSL by opening Docker Desktop settings, navigating to Resources → WSL integration, and enabling integration with your default WSL distribution.
Create a directory for your Docker setup (like D:\Tools\Docker\my-dev) and add a Dockerfile with your preferred configuration. Build your image:
docker build -t ubuntu-demo .
Launch a container with your project directories mounted:
docker run -it --name claude-code
-v D:/Tools/Docker/ClaudeCode/Claude:/workspace/claude
-v D:/Tools/Docker/ClaudeCode/Code:/workspace/project
ubuntu-demo
Inside the container, follow the same installation steps as the WSL method. This gives you a completely reproducible development environment that you can share with team members or deploy anywhere.
Linux users have the simplest installation path. Claude Code supports Ubuntu 18.04+, CentOS 7+, Debian 10+, and Fedora 30+ natively.
Open your terminal and run the environment check:
curl -fsSL https://download.aicodemirror.com/env_deploy/env-install.sh | bash
Install Claude Code globally:
npm install -g @anthropic-ai/claude-code
Configure your API credentials:
sudo apt-get install jq
curl -fsSL https://download.aicodemirror.com/env_deploy/env-deploy.sh | bash -s -- "your_api_key"
After restarting your terminal, you're ready to go. Navigate to any project and launch Claude Code with a simple claude command.
Mac users running macOS 10.15 or later can install Claude Code with minimal hassle. The process mirrors the Linux installation.
Open Terminal and run:
curl -fsSL https://download.aicodemirror.com/env_deploy/env-install.sh | bash
Install the package:
npm install -g @anthropic-ai/claude-code
Set up your credentials:
sudo apt-get install jq
curl -fsSL https://download.aicodemirror.com/env_deploy/env-deploy.sh | bash -s -- "your_api_key"
Restart Terminal, navigate to your project, and start coding with AI assistance.
Node Version Conflicts: If claude -v throws JavaScript errors, your Node version is likely the culprit. Upgrade to Node 20 or higher. While version 18 sometimes works, version 20+ provides the most stable experience.
Previous Installation Conflicts: If you've installed other versions of Claude Code before, completely uninstall them first using npm uninstall -g @anthropic-ai/claude-code. Run this as administrator on Windows if needed.
Environment Variable Issues: If you're getting API errors after installation, check your environment variables. On Mac, edit the hidden .zshrc file in your home directory and remove any conflicting Claude-related variables. On Windows, delete the .claude file in your user directory. On Linux, run rm ~/.claude and restart.
Once Claude Code is installed, the real magic begins. Simply type your instructions in natural language, and Claude Code automatically orchestrates the necessary tasks and operations.
For developers interested in taking their AI-powered development further, 👉 discover advanced AI coding tools and techniques that can transform how you write, debug, and optimize code across any programming language or framework.
The installation might seem involved at first glance, especially with the Docker or WSL options, but each method serves different needs. Choose direct installation for simplicity, WSL for Linux compatibility, or Docker for complete environment isolation. Whichever path you take, you'll have a powerful AI coding assistant ready to accelerate your development workflow.