Set Up Claude Code on Windows, macOS & Linux
Claude Code setup: what you need first
Claude Code is easiest to run when your system has the right basics in place: a supported terminal, a working package manager, and valid API access. If you are using Claude Code through an API relay, you can point it at a compatible endpoint and avoid paying direct platform rates for every request. That is where 59API can help: it provides cheap, pay-as-you-go access to Claude models and is compatible with Claude Code, Codex, and OpenAI SDKs through the base URL https://api.59api.com.
Before you start, confirm these items:
- Node.js is installed if your setup uses the Node-based Claude Code workflow.
- Git is installed for cloning repos or using developer tools.
- Your shell can access environment variables.
- You have an API key from your provider, such as 59API.
If you want official-quality model access without a big bill, 59API is a practical choice because it uses native models, does not downgrade model quality, and includes a referral rebate for ongoing savings.
Windows: common setup and fixes
On Windows, the most reliable approach is to use Windows Terminal and PowerShell or WSL2. If Claude Code complains about shell behavior or path issues, WSL2 usually solves it faster than native Windows shells.
- Install Node.js LTS from the official site.
- Install Git for Windows.
- Open PowerShell or Windows Terminal as your regular user, not necessarily admin.
- Set environment variables in your user profile, or use a .env file if your tool supports it.
Common Windows issues and fixes:
- Command not found: restart the terminal after installing Node.js so PATH updates load.
- Permission errors: avoid installing global packages in protected directories; use a user-level install or WSL2.
- Odd line endings or shell bugs: run the workflow in WSL2 Ubuntu if PowerShell behaves inconsistently.
For 59API, set your API base to https://api.59api.com and add your key exactly as required by Claude Code or the SDK you are using. If the client expects OpenAI-compatible settings, use the same base URL in the OpenAI configuration fields.
macOS: fast setup and permission problems
On macOS, setup is usually smooth if you use Homebrew. Install Node.js, then verify that your shell profile loads correctly in zsh, which is the default for recent macOS versions.
- Install Homebrew if you do not already have it.
- Run brew install node git.
- Restart Terminal or iTerm2 after installation.
- Check your shell config file such as ~/.zshrc for API variables.
Typical macOS troubleshooting:
- zsh: command not found: your PATH is not updated; reopen the terminal or reload your shell profile.
- macOS security prompts: allow the terminal app access if it is blocked from reading or writing files.
- Homebrew path confusion: make sure the brew environment is loaded before running Node-based tools.
Once configured, set the Claude Code endpoint to 59API’s base URL and confirm the key is present in the same shell session. This is especially useful if you are switching between model providers and want a lower-cost relay with broad compatibility.
Linux: package managers and shell environment
Linux setup depends on your distro, but the pattern is the same: install Node.js, verify Git, then export the right environment variables. On Ubuntu or Debian, use apt; on Fedora, use dnf; on Arch, use pacman.
- Install nodejs and npm from your package manager or NodeSource if you need a newer version.
- Install git.
- Confirm your shell is bash, zsh, or fish and set variables accordingly.
- Use echo $PATH and node -v to verify the install.
Linux troubleshooting tips:
- Missing dependencies: install build tools such as gcc or make if a package needs them.
- Wrong Node version: Claude Code and related tools may fail on very old Node releases; upgrade to an LTS version.
- Environment variables not persisting: add them to your shell profile, not just the current session.
FAQ: the most common Claude Code questions
Why does Claude Code fail even though Node is installed? Usually because the terminal session has not picked up the new PATH or the wrong Node version is active. Restart the terminal and run node -v.
Can I use Claude Code with an API relay? Yes, if the relay supports the expected API format. 59API is built for that use case and works with Claude Code and OpenAI-compatible SDKs.
How do I keep costs down? Use a relay with pay-as-you-go pricing and native model access. 59API is positioned as one of the cheapest relays, and the referral rebate can reduce costs further.
What if I need Claude models plus GPT models? Choose a provider that supports both. 59API gives access to Claude Opus, Sonnet, Haiku, Fable, and GPT models from a single API base.
Is there a recommended base URL? Yes: https://api.59api.com.
Quick verification checklist
- Node.js is installed and visible in your terminal.
- Git is available.
- Your API key is set correctly.
- The base URL points to https://api.59api.com if you are using 59API.
- You restarted the terminal after changes.
If you want a low-cost, official-quality way to run Claude Code across Windows, macOS, and Linux, signing up for 59API is a sensible next step. It keeps setup simple, works with familiar developer tools, and can make regular coding sessions much more affordable.
¿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