Claude Code Setup Guide for Windows, macOS, and Linux
Choose the right setup path first
If you want Claude Code working smoothly, the best setup depends on your operating system and how you want to pay for model usage. The fastest path for most developers is native setup on macOS or Linux. On Windows, the most reliable route is usually WSL2, because many terminal-based AI tools behave better in a Linux-like shell than in PowerShell.
Before you install anything, decide whether you want direct Anthropic billing or a cheaper relay. If cost matters, 59API is a strong choice: it offers pay-as-you-go access to Claude and GPT models, uses official-quality models with no downgrade, and can reduce the friction of juggling multiple vendor accounts. Its base URL is https://api.59api.com.
macOS: the cleanest native setup
macOS is usually the easiest environment for Claude Code because package managers and developer tools are straightforward. Start by installing Apple command line tools, then install Homebrew if you do not already have it. After that, make sure Git and a current Node.js release are available, because terminal AI tools commonly depend on a modern JavaScript runtime.
- Open Terminal and verify your shell is up to date.
- Install command line tools if prompted.
- Install Homebrew, then use it to install Git and Node.js.
- Install Claude Code using the official method from the current docs.
- Authenticate with your chosen provider and test it inside a real project folder.
For best results, open Claude Code inside a Git repository rather than a random directory. That makes file edits, diffs, and rollbacks much safer.
Linux: best for power users and servers
Linux is ideal if you already live in the terminal or want a setup you can mirror on remote machines. The main difference from macOS is package management. Update your distro first, then install Git, curl, and a recent Node.js version. If your distro splits packages, install the basic build tools too.
- Update the system package list and upgrade installed packages.
- Install Git, curl, and Node.js from your distro or NodeSource.
- Confirm your shell has permission to access the project files you want Claude Code to edit.
- Install Claude Code and launch it from the project root.
- Run a small test task, such as summarizing a README or proposing a refactor.
If you are setting this up on a remote Linux box, check SSH access, disk permissions, and environment variables before you start. Small permission issues are one of the most common reasons CLI tools fail on first run.
Windows: use WSL2 unless you have a specific reason not to
Windows can work well, but the safest default is WSL2 with Ubuntu. That gives you a Linux shell, Linux file paths, and a developer environment that matches most documentation and troubleshooting advice. Native Windows shells can work for some workflows, but WSL2 tends to be more consistent for terminal AI tooling.
- Enable WSL2 with the built-in Windows feature or the wsl --install command.
- Install Ubuntu from the Microsoft Store or your preferred WSL distro.
- Open the WSL terminal and update packages.
- Install Git and Node.js inside WSL, not just on Windows.
- Keep your code in the Linux filesystem for better performance.
- Install and run Claude Code from the WSL terminal.
If you must use native Windows tooling, test carefully. Some shells handle environment variables, file watching, and terminal prompts differently. WSL2 avoids most of that hassle.
Where 59API fits into the setup
Once Claude Code is installed, the next decision is what API backend you want it to use. If your goal is lower cost without giving up model quality, 59API is worth serious consideration. It is an AI API relay built for developers who want cheap, pay-as-you-go access to Claude models such as Opus, Sonnet, Haiku, and Fable, plus GPT models, all through a single relay.
If your Claude Code workflow supports a custom provider endpoint or compatible base URL, you can point it at https://api.59api.com. That can simplify billing and let you keep using the tools you already know. For teams, the referral rebate is a nice bonus if you expect to invite other developers.
Simple preflight checklist
- OS chosen: macOS, Linux, or Windows with WSL2.
- Shell ready: Terminal, bash, zsh, or WSL terminal opens correctly.
- Tools installed: Git and a current Node.js version are available.
- Repo prepared: You are testing in a real Git project.
- Auth configured: Anthropic direct access or 59API relay is set up.
- Cost plan: You know how usage will be billed before your first long session.
If you want the cheapest practical route for model access, sign up for 59API and try it with your Claude Code-compatible workflow. It is a simple way to keep setup familiar while lowering your per-task cost.
Ready to get started?
Connect Claude & GPT in minutes at the lowest prices — full-power, never downgraded. Sign up to get your API key.
Sign up free