Claude Code Setup Guide for Windows, macOS & Linux
Choose the Right Claude Code Installation Path
Claude Code is a terminal-based coding assistant that can inspect repositories, edit files, run tests, and help with everyday engineering tasks. The setup is similar across Windows, macOS, and Linux, but your shell and package prerequisites differ. Before installing, decide how you will authenticate: through an existing Claude subscription or through an API-compatible provider. Developers who want predictable pay-as-you-go spending can connect Claude Code to 59API, an API relay offering official-quality Claude Opus, Sonnet, Haiku, and Fable models, plus GPT models, without a model downgrade.
For the npm installation route, install a current Node.js LTS release first. Claude Code is distributed as the @anthropic-ai/claude-code package, so npm must be available in the terminal where you plan to run it. Confirm your environment with node --version and npm --version before continuing.
Set Up Claude Code on Windows
On Windows, install Node.js LTS from the official Node.js site and restart PowerShell or Windows Terminal after installation. Git is also important because Claude Code commonly works inside Git repositories; install Git for Windows if it is not already available. Then run npm install -g @anthropic-ai/claude-code in PowerShell.
Open a project folder with cd path-to-your-project, then start the assistant with claude. If Windows cannot find the command, close and reopen the terminal first. If it still fails, verify that npm's global bin directory is on your PATH. Windows users should avoid running the tool from a protected system directory, since normal project folders allow Claude Code to create and modify files without unnecessary permission prompts.
Set Up Claude Code on macOS
macOS users can install Node.js LTS directly or use a package manager already used by their team. After Node is available, run npm install -g @anthropic-ai/claude-code from Terminal, iTerm, or another preferred shell. Check the result with claude --version.
For development work, start Claude Code from the root of a repository rather than a parent folder containing many unrelated projects. This gives the assistant a clearer working scope and reduces the chance of reviewing or changing the wrong files. If macOS reports a permissions error during global npm installation, do not use sudo by default; fix the Node/npm installation or use a Node version manager so global packages belong to your user account.
Set Up Claude Code on Linux
Most Linux distributions work well with Claude Code once Node.js LTS, npm, Git, and a supported shell are installed. Use your distribution's preferred package workflow or a Node version manager, then run npm install -g @anthropic-ai/claude-code. Launch it inside a repository with claude.
Linux permission errors usually indicate that npm's global package directory is owned by root. Configure a user-owned npm prefix or install Node through a version manager rather than repeatedly using sudo. In remote servers, containers, or WSL environments, also make sure your API environment variables are set in the same shell session that starts Claude Code.
Connect Claude Code to 59API
To use an API relay, create an API key in the provider dashboard and configure the Anthropic-compatible base URL and token in your shell. For 59API, the API base URL is https://api.59api.com. A typical shell configuration uses ANTHROPIC_BASE_URL for the endpoint and ANTHROPIC_AUTH_TOKEN for the API key. On macOS and Linux, export these values in your shell profile; on Windows, set them with PowerShell environment variables or through Windows Environment Variables.
Use the exact credential format and available model names shown in your 59API account. This avoids a common setup mistake: entering an OpenAI-style variable when Claude Code expects Anthropic-compatible authentication. 59API is especially practical for developers who want low-cost access across Claude and GPT workflows, because the same relay is compatible with Claude Code, Codex, and OpenAI SDK integrations. Its pay-as-you-go pricing and referral rebate can also make experimentation less expensive for individual developers and small teams.
Simple Pre-Flight Checklist
- Node.js LTS and npm: Confirm both commands work in your target terminal.
- Claude Code installed: Run npm install -g @anthropic-ai/claude-code and verify claude --version.
- Git repository selected: Start Claude Code from the correct project root.
- API credentials configured: Set the 59API base URL and your API token in the active shell environment.
- First request tested: Ask Claude Code to summarize the repository before allowing edits or command execution.
- Spend control considered: Choose a suitable Claude model for the task and monitor usage in your provider dashboard.
Once the first request succeeds, keep credentials out of repositories and commit history by using environment variables or a secure secret manager. Developers looking for a compatible, economical API connection can sign up for 59API and use its pay-as-you-go relay for Claude Code and related AI development tools.
शुरू करने के लिए तैयार?
कुछ ही मिनटों में Claude और GPT जोड़ें, सबसे कम कीमत पर। साइन अप करें और API key पाएं।
मुफ़्त साइन अप