Skip to content

Step 1: Install Node.js

Method 1: Install with Homebrew (Recommended)

bash
brew install node

If Homebrew is not installed, install it first:

bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Method 2: Download from official site

  1. Visit https://nodejs.org
  2. Download and install the LTS .pkg file

TIP

Verify installation

bash
node --version
npm --version

Step 2: Install Claude Code

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

TIP

Verify Claude Code installation

bash
claude --version

Step 3: Set environment variables

Determine your shell type

bash
echo $SHELL

macOS Catalina and later use zsh by default.

Method 1: Temporary (current session)

bash
export ANTHROPIC_BASE_URL="https://api.bsf.ai"
export ANTHROPIC_AUTH_TOKEN="your_api_key"

Method 2: zsh permanent (Recommended)

bash
echo '' >> ~/.zshrc
echo '# API config' >> ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="https://api.bsf.ai"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your_api_key"' >> ~/.zshrc
source ~/.zshrc

Method 3: bash permanent

bash
echo 'export ANTHROPIC_BASE_URL="https://api.bsf.ai"' >> ~/.bash_profile
echo 'export ANTHROPIC_AUTH_TOKEN="your_api_key"' >> ~/.bash_profile
source ~/.bash_profile

Method 4: Config File (Recommended)

Edit config file vim ~/.claude/settings.json

json
{
"env": {
   "ANTHROPIC_AUTH_TOKEN": "Replace with your API Key",
   "ANTHROPIC_BASE_URL": "https://api.bsf.ai",
   "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
 },
 "permissions": {
   "allow": [],
   "deny": []
 }
}

TIP

Verify environment variables

bash
echo $ANTHROPIC_BASE_URL
echo $ANTHROPIC_AUTH_TOKEN

Step 4: Start using

Launch Claude Code

bash
claude

Use in a specific project

bash
cd ~/Projects/my-project
claude

FAQ

Issue: Security blocking execution
  1. Open System Preferences > Privacy & Security
  2. Find the blocked app and click Open Anyway
Issue: npm permission error (EACCES)

When encountering EACCES errors, fix npm permissions:

bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
npm install -g @anthropic-ai/claude-code