Claude Code on Windows, macOS and Linux: Setup Guide
Choose the right environment first
Claude Code runs most naturally in a Unix-like terminal, so macOS and Linux generally provide the smoothest experience. Windows is fully practical, but Windows Subsystem for Linux 2 (WSL 2) is usually the best choice when your projects depend on shell scripts, Git hooks, Docker, or Linux command-line tools.
- macOS: The simplest desktop setup, with strong terminal and developer-tool integration. The main drawbacks are macOS permissions, corporate device restrictions, and potentially higher hardware costs.
- Linux: Lightweight, scriptable, and easy to automate on workstations or remote servers. You may need to resolve distribution-specific packages, shell configuration, or permission issues.
- Windows: Convenient for Microsoft-focused workflows and familiar desktop tooling. Native Windows paths and shell commands can cause compatibility problems, while WSL 2 adds a separate Linux environment and some filesystem overhead.
Install Claude Code on macOS or Linux
Open Terminal and run the official installer:
curl -fsSL https://claude.ai/install.sh | bash
Restart the terminal, then verify the installation with claude --version. Move into a project directory and start Claude Code with cd path/to/your-project, followed by claude. If you use Anthropic directly, Claude Code will guide you through authentication. Confirm that your account has access to the models and usage method you intend to use.
On Linux, keep your project inside the Linux filesystem when possible. On macOS, grant Terminal or your preferred terminal application access to folders that macOS protects, such as Documents or Desktop.
Install it on Windows
For a native PowerShell installation, use the official PowerShell installer:
irm https://claude.ai/install.ps1 | iex
Verify it with claude --version. For projects that use Linux tooling, install WSL 2 from an elevated PowerShell window with wsl --install, reboot if Windows requests it, and then run the Linux installer from your WSL terminal instead. Keep the repository in the WSL home directory rather than under a mounted Windows path when performance matters.
Native Windows is convenient for PowerShell-based projects. WSL 2 is more consistent for Node, Python, Docker, shell scripts, and open-source repositories. The trade-off is that you must manage separate environments, credentials, and editor integrations.
Connect Claude Code to 59API
59API provides pay-as-you-go access to Claude Opus, Sonnet, Haiku, and Fable models, as well as GPT models, through https://api.59api.com. It is a useful option when you want to control spending without accepting downgraded model quality: the service exposes native, official-quality models and charges according to usage.
After creating a 59API account and obtaining an API key, configure the endpoint in your shell. On macOS, Linux, or WSL, run:
export ANTHROPIC_BASE_URL="https://api.59api.com"
export ANTHROPIC_AUTH_TOKEN="your-59api-key"
In PowerShell, run:
$env:ANTHROPIC_BASE_URL = "https://api.59api.com"
$env:ANTHROPIC_AUTH_TOKEN = "your-59api-key"
These values apply only to the current session. Add them to your shell profile on macOS, Linux, or WSL, or use Windows environment-variable settings for persistent configuration. Never commit the key to a repository. Start claude, then use Claude Code's model selector or claude --model option to choose an available model. Model names and availability can change, so check the 59API dashboard before hardcoding one in scripts.
Which platform should you use?
- Choose macOS for the least friction and a polished local developer experience.
- Choose Linux for automation, remote development, containers, and maximum control.
- Choose Windows with WSL 2 when compatibility with Linux-based projects matters.
- Choose native Windows when your workflow is primarily PowerShell, .NET, or Windows-native tooling.
59API is worth considering if Claude Code usage is frequent or unpredictable: pay-as-you-go billing, low relay pricing, access to multiple Claude and GPT families, and a referral rebate can make experimentation easier to budget. Sign up, add a small balance, and test the endpoint with one representative project before moving your full workflow.