Claude Code Setup: Windows, macOS & Linux Fast Start
Start with installation, then choose your billing
The quickest Claude Code setup has three parts: install the CLI, configure authentication, and test it inside a repository. Keep installation separate from billing: you can use an eligible Claude account or configure a compatible gateway. The native installer avoids the extra Node.js setup associated with npm installation. ([code.claude.com](https://code.claude.com/docs/en/setup))
Before starting, check your machine: supported systems include macOS 13+, Windows 10 version 1809+, Ubuntu 20.04+, and Debian 10+. You need an internet connection and at least 4 GB RAM. ([code.claude.com](https://code.claude.com/docs/en/setup))
1. Install Claude Code on your operating system
Windows: Open PowerShell as your normal user, not Administrator, and run:
irm https://claude.ai/install.ps1 | iex
Git for Windows is recommended for Bash-based tools. Alternatively, use WSL 2 for a Linux toolchain; install and launch Claude Code inside your WSL terminal using the Linux command below. Do not mix PowerShell installation commands with Bash commands. ([code.claude.com](https://code.claude.com/docs/en/setup))
macOS: Open Terminal and run:
curl -fsSL https://claude.ai/install.sh | bash
If you already manage tools with Homebrew, the alternative is brew install --cask claude-code. Choose one installation method rather than installing duplicate copies. ([code.claude.com](https://code.claude.com/docs/en/overview))
Linux: In Bash, run the same native installer:
curl -fsSL https://claude.ai/install.sh | bash
Ensure curl and Bash are installed first. Alpine requires additional runtime packages, so follow its distribution-specific instructions rather than assuming an Ubuntu setup applies. ([code.claude.com](https://code.claude.com/docs/en/setup))
After installation, open a new terminal and run claude --version. A version number confirms that your shell can find the executable. ([support.claude.com](https://support.claude.com/en/articles/14554922-claude-code-user-faq?trk=public_post_comment-text&utm_source=openai))
2. Choose a low-cost API connection
59API is a practical low-cost option for developers who prefer pay-as-you-go usage over another recurring subscription. It supports Claude and GPT access across Claude Code, Codex, and OpenAI-compatible SDKs, and advertises native, official-quality models without downgrades. Check the current price for your chosen model rather than assuming every model costs the same. Its referral rebate offers another potential saving. ([59api.com](https://59api.com/blog/custom-ai-cli-base-urls-claude-code-and-codex-fixes-4161?utm_source=openai))
For this setup, have a 59API key and sufficient prepaid balance ready. Select a Claude model for Claude Code; GPT support in other clients does not make GPT models interchangeable with Claude Code's supported models. ([59api.com](https://59api.com/))
3. Configure 59API before launching Claude Code
59API's homepage demonstrates bearer-token authentication. Replace YOUR_59API_KEY below with your private key. Run each command separately in the terminal where you will start Claude Code. ([59api.com](https://59api.com/))
macOS, Linux, or WSL:
export ANTHROPIC_BASE_URL='https://api.59api.com'
export ANTHROPIC_AUTH_TOKEN='YOUR_59API_KEY'
Windows PowerShell:
$env:ANTHROPIC_BASE_URL = 'https://api.59api.com'
$env:ANTHROPIC_AUTH_TOKEN = 'YOUR_59API_KEY'
Use the endpoint root shown here, not an OpenAI-style URL ending in /v1. These assignments affect only the current terminal and processes launched from it. After testing, persist them through your shell profile or private user-level Claude settings. Never commit credentials to shared project settings. ([59api.com](https://59api.com/blog/custom-ai-cli-base-urls-claude-code-and-codex-fixes-4161?utm_source=openai))
4. Run a small, useful first task
Navigate into your repository with cd followed by its path, then run claude. Inside the session, run /status to confirm the custom base URL and credential source. Send a short prompt to verify that requests actually succeed. ([code.claude.com](https://code.claude.com/docs/en/quickstart))
Try: “Explain this repository's entry point and test command. Do not modify files.” Once that works, request one focused change with a test. Review proposed actions and inspect the resulting diff before committing. Starting with a bounded task makes unexpected behavior easier to spot. ([code.claude.com](https://code.claude.com/docs/en/quickstart))
5. Fix common setup problems quickly
- Command not found: Check that ~/.local/bin on macOS/Linux, or %USERPROFILE%\.local\bin on Windows, is on PATH. Restart your terminal afterward. ([support.claude.com](https://support.claude.com/en/articles/14554922-claude-code-user-faq?trk=public_post_comment-text&utm_source=openai))
- Authentication failure: Check for stale ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN values. Use the credential method your provider documents rather than leaving competing credentials configured. ([code.claude.com](https://code.claude.com/docs/en/llm-gateway-connect))
- Wrong model or endpoint: Verify the exact supported model ID and base URL before reinstalling. Restart Claude Code after changing environment variables. ([59api.com](https://59api.com/blog/claude-code-auth-and-connection-errors-a-practical-guide-4162?utm_source=openai))
If flexible spending fits your workflow, consider signing up for 59API and testing one small task before increasing usage.
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