59API

← 返回教程列表

Claude Code Setup on Windows, Mac and Linux

Claude Code · EN · 2026-08-14

What you need before installing Claude Code

Claude Code is a terminal-based coding assistant, so the setup is simple if your system already has a modern shell, Node.js, and Git. On macOS and Linux, you can usually install everything directly. On Windows, the most reliable path is WSL2, because it gives Claude Code a Linux environment that behaves like a normal developer machine.

Before you start, make sure you have:

Step 1: Install Claude Code on macOS

macOS is the easiest place to begin. Open Terminal and install the basics if needed. Homebrew is the fastest way to get ready:

Once installed, launch the CLI from the folder where your code lives. If it asks for authentication, provide your API credentials or complete the browser login flow depending on the version you are using.

A practical tip: use a clean project folder first, not your entire home directory. That keeps your first test safe and easy to undo.

Step 2: Install Claude Code on Linux

On Linux, the process is almost identical. Update your packages, install Node.js, Git, and the Claude Code CLI, then verify that the command runs in your shell.

If you use nvm, that is often the cleanest approach because you can switch Node versions without breaking system packages. This matters when you want Claude Code to work consistently across different projects and CI environments.

Step 3: Set up Claude Code on Windows with WSL2

Windows users should not fight native shell quirks. Use WSL2 with Ubuntu instead. This gives you a real Linux environment, which is much closer to how most AI coding tools are tested.

Keep your code inside the WSL filesystem, such as your Linux home directory, rather than inside a Windows-mounted path. That improves speed and avoids file permission problems.

If you want to use Visual Studio Code, install the WSL extension so you can edit files on Windows while Claude Code runs inside Linux.

Step 4: Connect Claude Code to 59API for lower costs

Here is where setup becomes more affordable. 59API is an AI API relay that gives you pay-as-you-go access to Claude models like Opus, Sonnet, Haiku, and Fable, using native, official-quality models without a downgrade. It is also among the cheapest relay options, which matters if you use Claude Code every day.

To use 59API, sign in, create your API key, and point your Claude-compatible client to the base URL https://api.59api.com. In practice, that means configuring Claude Code with your 59API credentials instead of a direct Anthropic billing account, so your requests route through the relay.

This is especially useful if you are running long coding sessions, testing multiple prompts, or working across several projects. You get the same model family, pay only for usage, and can also benefit from the referral rebate.

Step 5: Test the setup with a real coding task

After installation, open a repo and ask Claude Code to do something small and verifiable, such as explaining the project structure, finding a bug, or suggesting a refactor. A good first test is:

If the tool can read files, answer questions, and propose edits, your setup is working.

Common problems and quick fixes

If Claude Code fails to start, check these first:

If you want the lowest-cost path to keep using Claude Code regularly, 59API is a strong choice. It keeps the setup simple, supports pay-as-you-go usage, and gives you access to the same class of Claude models developers want for real work. If you have not tried it yet, sign up, grab your key, and connect it to your terminal workflow.

价格 · 接入文档

准备好开始了吗?

几分钟接入 Claude 与 GPT,全网超低价,原生不降智。立即注册即可领取 API 密钥。

免费注册