Claude Code Installation and Configuration
Claude Code is Anthropic's terminal-based coding agent. This guide covers installation on macOS and Windows, followed by authentication through either Anthropic or Ya Code's Anthropic-compatible endpoint.
I. Prerequisites
- macOS 10.15 or later, or Windows 10 version 1809 / Windows Server 2019 or later.
- Native Windows use requires Git for Windows. WSL users can follow the Linux installation path instead.
- Use a Claude account for Anthropic's service. To use Ya Code, create an access key first. Do not combine the two authentication methods.
- Commands and system requirements can change; check the official Claude Code installation guide before installing.
II. Installation (macOS and Windows)
macOS
Run Anthropic's recommended native installer:
curl -fsSL https://claude.ai/install.sh | bash
claude --versionHomebrew is also supported:
brew install --cask claude-codeWindows
Run the official installer from PowerShell:
irm https://claude.ai/install.ps1 | iex
claude --versionIf claude is not found after installation, close and reopen the terminal. On managed devices, ask an administrator to review the installer instead of weakening the machine-wide script execution policy.
III. Configuration Directories (macOS and Windows)
macOS
- User settings:
~/.claude/settings.json - User state:
~/.claude.json; Claude Code manages this file, so do not use it as a hand-maintained gateway configuration. - Shared project settings:
<project>/.claude/settings.json - Local project settings:
<project>/.claude/settings.local.json
Windows
- User settings:
%USERPROFILE%\.claude\settings.json - User state:
%USERPROFILE%\.claude.json; this file is managed by Claude Code. - Shared project settings:
<project>\.claude\settings.json - Local project settings:
<project>\.claude\settings.local.json
Create the user directory if it does not exist. See the Claude Code settings documentation for scope and precedence. If you set CLAUDE_CONFIG_DIR, use that custom location instead.
IV. Configuration Examples
The following user-level settings.json connects Claude Code to Ya Code. Replace the placeholder locally and never commit a real key:
{
"env": {
"ANTHROPIC_BASE_URL": "https://yacode.xyz",
"ANTHROPIC_AUTH_TOKEN": "sk-your-yacode-key"
}
}To avoid storing a key in plain-text JSON, keep only ANTHROPIC_BASE_URL in the file and set the token for the current terminal session before launching Claude Code:
export ANTHROPIC_AUTH_TOKEN="sk-your-yacode-key"
claude$env:ANTHROPIC_AUTH_TOKEN="sk-your-yacode-key"
claudeV. Configuration Notes
ANTHROPIC_BASE_URLselects the Ya Code root URL; Claude Code then calls an Anthropic Messages-compatible endpoint.ANTHROPIC_AUTH_TOKENsends the Ya Code key as a bearer token. Do not setANTHROPIC_API_KEYat the same time, as competing authentication headers can cause failures.- For Anthropic's hosted service, leave the Ya Code variables unset, run
claude, and follow the sign-in flow. See the Claude Code authentication guide. settings.jsonuses JSON. Shared project settings are suitable for team-wide behavior, but credentials belong in user settings, environment variables, or an approved secret manager.
VI. Important Notes
sk-your-yacode-keyis a nonfunctional placeholder. Never expose a real key in source control, screenshots, or logs.- Native installations update automatically. When options differ by release, follow the official Claude Code documentation.
- Gateway support depends on both the Claude Code release and the gateway's compatibility with the Anthropic Messages API. For authentication or model errors, record
claude --versionand verify the models currently available through Ya Code. - Claude Code can read and modify files in the current project. Review repository instructions and the requested permission scope before using it in an unfamiliar codebase.