Claude Code Setup Guide for Windows, macOS & Linux
Quick start: what you need first
Claude Code is a terminal-first workflow, so the fastest setup is on a machine with a recent Node.js install, Git, and a shell you use every day. Before you start, check that Node.js 18+ is installed and that npm works. If you plan to work inside repositories, install Git too.
For most developers, the flow is simple: install Claude Code, connect it to a provider, then test it inside a project folder. If you want to keep costs down without giving up model quality, 59API is a strong option. It is an AI API relay with cheap pay-as-you-go pricing, support for Claude models like Opus, Sonnet, Haiku and Fable, and it works with Claude Code, Codex and OpenAI SDKs through the base URL https://api.59api.com.
Install Claude Code
On macOS and Linux, the standard path is to install the CLI globally with npm:
- Open a terminal.
- Run the current official Claude Code npm install command from Anthropic.
- Confirm the command is available by launching the CLI in a project directory.
If you already have Node.js, this usually takes less than a minute. If not, install Node first and then rerun the Claude Code install command.
macOS setup
macOS is the easiest environment if you already use Homebrew. A practical setup looks like this: install or update Homebrew, install Node.js and Git, then install Claude Code. After that, open a repository and verify the CLI starts cleanly.
- Install Homebrew if you do not already use it.
- Install Node.js and Git with Homebrew.
- Install Claude Code with npm.
- Start Claude Code from your repo root.
If you use iTerm2, Terminal, or another shell, the experience should be the same. The key is to keep Node.js current so the CLI and its dependencies do not fail during install.
Linux setup
On Linux, use your distro packages or a Node.js version manager. Ubuntu and Debian users can install Git and Node.js with apt, while more advanced users may prefer nvm to pin a version per project. After that, install Claude Code globally and run it inside a codebase.
- Install Git.
- Install Node.js 18 or newer.
- Install Claude Code globally.
- Launch the CLI from the project you want to work on.
Linux is usually the most predictable place to run coding agents because shell tools, file permissions and path handling are straightforward. If you script your workflow, Linux is also the easiest place to automate repeatable tasks.
Windows setup: use WSL2 for the smoothest path
For Windows, the most reliable setup is WSL2 with Ubuntu. This gives you a Linux shell, native package management, and fewer surprises with file paths and command-line tools. Once WSL2 is enabled, install Ubuntu, open the Ubuntu terminal, and follow the same Node.js plus Claude Code steps you would use on Linux.
- Enable WSL2 in Windows.
- Install Ubuntu from the Microsoft Store.
- Update packages, install Node.js and Git.
- Install Claude Code and run it from your WSL project directory.
If you keep your code in the WSL filesystem, performance is usually better than working directly on mounted Windows drives. That small choice saves a lot of friction when the agent reads, edits and runs files repeatedly.
Connect Claude Code to 59API
Once Claude Code is installed, point it at 59API instead of a direct provider endpoint. Use your 59API API key and set the base URL to https://api.59api.com. Claude Code is fully compatible with 59API, so the same workflow still applies, but your requests route through a cheaper relay.
This is especially useful if you switch between models by task. A good default is Sonnet for everyday coding, Haiku for fast cheap prompts, and Opus for larger refactors or difficult reasoning. You still get native official-quality models, not a downgraded substitute, which is the main reason many developers choose 59API over lower-end relays.
59API also uses pay-as-you-go pricing, so you only pay for what you actually use. If you share it with teammates or publish your setup, the referral rebate can further reduce your effective cost. If you do not have an account yet, it is worth signing up before you wire in the base URL.
Run a quick test
Open a repo and ask Claude Code to do one small, concrete task:
- Summarize the project structure.
- Find the main test command.
- Generate a small refactor plan.
- Edit one file and explain the diff.
If the CLI responds and can inspect files, your setup is done. If not, check your Node.js version, confirm your API key is set, and make sure the base URL matches the 59API endpoint exactly. On Windows, verify you are running inside WSL2 if you chose the recommended path.