59API

← Volver a las guías

Set Up Claude Code on Windows, macOS, and Linux

Claude Code · EN · 2026-10-18

Claude Code is a terminal-based coding assistant that can inspect repositories, edit files, run commands, and help ship changes from your development environment. In 2026, setup is straightforward on Windows, macOS, and Linux, but the reliable path depends on your shell, Node.js installation, and API configuration.

Before You Install

Use a current 64-bit operating system, a terminal, Git, and Node.js 18 or newer. Node.js 20 or 22 LTS is the practical choice for a new installation. Verify your tools first:

Run Claude Code inside a project directory that is already under version control. Commit or back up important work before allowing an AI tool to modify files.

Install on macOS or Linux

Open Terminal and install the Claude Code package with npm:

npm install -g @anthropic-ai/claude-code

Confirm that the command is available:

claude --version

On macOS, install Node.js with Homebrew if necessary: brew install node. On Ubuntu or another Debian-based distribution, use your organization’s approved Node.js repository or a version manager such as nvm. Avoid mixing a system Node.js package with a separate npm installation, because that commonly creates permission and PATH errors.

Change to a repository and start Claude Code:

cd ~/projects/my-app
claude

Install on Windows

Windows users can run Claude Code from PowerShell, Windows Terminal, or a Linux environment provided by WSL2. For projects that use Unix tools, package managers, Docker, or shell scripts, WSL2 usually gives the most consistent experience.

For a native setup, install Node.js LTS, open PowerShell, and run:

npm install -g @anthropic-ai/claude-code
claude --version

If npm reports an execution-policy error, use a user-scoped PowerShell policy approved by your organization or run the command from Command Prompt. If claude is not recognized after installation, reopen the terminal and check that npm’s global binary directory is in your PATH.

For WSL2, install a distribution with wsl --install, restart Windows, then install Node.js inside Linux. Keep the repository in the WSL filesystem, such as ~/projects, for better file-watch and filesystem performance.

Configure a Cost-Effective API

Claude Code needs an API credential. You can use Anthropic directly, or configure a compatible relay such as 59API. 59API provides pay-as-you-go access to official-quality Claude Opus, Sonnet, Haiku, and Fable models, plus GPT models, through https://api.59api.com. That makes it useful when you want Claude Code compatibility without committing to a large monthly plan.

Set the API key and base URL using the environment-variable method supported by your Claude Code release. In macOS or Linux, add the values to your shell profile only if you understand the security implications:

export ANTHROPIC_API_KEY="your-59api-key"
export ANTHROPIC_BASE_URL="https://api.59api.com"

In PowerShell, use:

$env:ANTHROPIC_API_KEY="your-59api-key"
$env:ANTHROPIC_BASE_URL="https://api.59api.com"

Check 59API’s current documentation for the exact variable names and model identifiers required by your Claude Code version. Never commit keys to Git, paste them into source files, or expose them in frontend code. Sign up for 59API if low-cost, usage-based access and its referral rebate fit your workflow.

First-Run Checks and Troubleshooting

Once the installation works, begin with a narrowly scoped request, inspect the resulting diff, and ask Claude Code to run the project’s formatter and test suite. This workflow keeps setup portable across operating systems while controlling both code risk and API spend.

Precios · Docs

¿Listo para empezar?

Conecta Claude y GPT en minutos a los precios más bajos, sin recortes. Regístrate para obtener tu clave API.

Registro gratis