How to Install Claude Code on macOS and Connect It to Domestic AI Models

This guide walks you through installing Claude Code on macOS, configuring it with the CC Switch tool to use domestic AI models, and demonstrates a simple "Hello, Claude Code!" HTML generation example, covering all required commands, settings, and troubleshooting steps.

Senior Brother's Insights
Senior Brother's Insights
Senior Brother's Insights
How to Install Claude Code on macOS and Connect It to Domestic AI Models

Claude Code overview

Claude Code is an AI‑powered programming assistant that can read codebases, edit files, run commands, build features, fix bugs, and automate development tasks via natural‑language prompts.

Installation on macOS

Two fast installation methods are demonstrated.

Official curl script (requires VPN) curl -fsSL https://claude.ai/install.sh | bash Homebrew cask brew install --cask claude-code@latest Verify the installation: claude --version A version string confirms success. The first launch shows a connection error to Anthropic’s API; this is resolved later by configuring a local model service.

Configuring a domestic model service with CC Switch

Because direct access to Anthropic is blocked in many Chinese networks, CC Switch is used to route Claude Code to a domestic model provider. The project repository is https://github.com/farion1231/cc-switch.

Install CC Switch via Homebrew:

brew tap farion1231/ccswitch
brew install --cask cc-switch

Open the CC Switch desktop application, add a new supplier, select “Claude”, and choose a domestic model (e.g., the GLM‑China version). Enter the provider’s API key; other parameters are auto‑filled. Save the configuration.

Running Claude Code – step‑by‑step example

Create a working directory and start Claude Code: claude Accept the default prompts for theme, security warnings, and trusted directory settings.

In the dialogue window, ask “What can you do?” to list supported skills.

Request a simple HTML page that displays Hello, Claude Code! with a tech‑style CSS theme. Claude Code generates an index.html file in the current directory.

Open index.html in a browser to view the generated page.

All commands are executed in the terminal; confirmations are entered by pressing Enter when prompted.

Key files and configuration

The global configuration file CLAUDE.md (not covered here) stores model and project‑level settings.

Images illustrating the process

Claude Code installation via Homebrew
Claude Code installation via Homebrew
Claude Code first launch error
Claude Code first launch error
CC Switch home screen
CC Switch home screen
Add new supplier in CC Switch
Add new supplier in CC Switch
Enter API key
Enter API key
Claude Code initial configuration
Claude Code initial configuration
Claude Code dialogue interface
Claude Code dialogue interface
Simple dialogue asking capabilities
Simple dialogue asking capabilities
Generated Hello Claude Code page
Generated Hello Claude Code page
index.html displayed in browser
index.html displayed in browser
Vibe CodingInstallationmacOSAI coding assistantModel configurationClaude CodeCC Switch
Senior Brother's Insights
Written by

Senior Brother's Insights

A public account focused on workplace, career growth, team management, and self-improvement. The author is the writer of books including 'SpringBoot Technology Insider' and 'Drools 8 Rule Engine: Core Technology and Practice'.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.