Run Claude Code on a Local Mac Model (Native MLX Setup)

Claude Code, with the model running on your own Mac. Rapid-MLX speaks the Anthropic Messages API Claude Code uses, so it's a base URL, not a bridge.

Run it on your Mac

qwen3.5-9b-4bit (~6 GB download; start with qwen3.5-4b-4bit on 18–24 GB)

1 · Install Rapid-MLX
curl -fsSL https://rapidmlx.com/install.sh | bash
2 · Launch claude-code
rapid-mlx launch claude-code --model qwen3.5-9b-4bit

Claude Code is a great agent, but every file it reads and every tool call goes to the cloud and is billed per token. For a lot of everyday work (refactors, questions about a codebase, edits to code you'd rather not upload) a capable model on your own Mac does the job.

The whole thing

  1. Install Rapid-MLX and serve a model.
  2. rapid-mlx agents claude-code --setup, or export two environment variables.
  3. claude in your project.

1 · Install Rapid-MLX and Claude Code

curl -fsSL https://rapidmlx.com/install.sh | bash
npm install -g @anthropic-ai/claude-code

Rapid-MLX is also in Homebrew core: brew install rapid-mlx.

2 · Serve a model

rapid-mlx serve qwen3.5-4b-4bit

This model fits 16 GB per the registry; the historical test below used a 32 GB Mac. The server listens on http://localhost:8000 with both OpenAI and Anthropic routes; keep it running.

Mac unified memory Model choices Download and memory guidance
16 GB qwen3.5-4b-4bit fits 16 GB per the registry; not verified live on a 16 GB Mac. About 3 GB download.
18–36 GB qwen3.5-9b-4bit default; start with qwen3.5-4b-4bit on 18–24 GB. About 6 GB for 9B or 3 GB for 4B.
48 GB+ qwen3.5-9b-4bit responsive default; qwen3.8-27b-4bit higher-capability option. About 6 GB for 9B or 16 GB for 27B; 27B needs roughly 20–26 GB free unified memory.

3 · Point Claude Code at it

The setup command writes the connection into Claude Code's own settings file, after showing you the change:

rapid-mlx agents claude-code --setup

It adds an env block to ~/.claude/settings.json with ANTHROPIC_BASE_URL, a placeholder key, the served model and its context window, and backs up the existing file first.

Prefer not to touch the settings file? Two environment variables do the same for one shell:

export ANTHROPIC_BASE_URL=http://localhost:8000
export ANTHROPIC_API_KEY=not-needed

The base URL is the server root, not …/v1. The Anthropic client adds /v1/messages itself, so http://localhost:8000/v1 would request /v1/v1/messages and fail.

4 · Run it

Start claude in a project as usual, or give it one task from the shell:

# inside your project folder
claude -p "Add a function add(a, b) to hello.py that returns a + b. Edit the file." \
  --allowedTools Read Edit Write

From our run:

I've added the `add(a, b)` function to `hello.py` that returns `a + b`.

Verified on 2026-10-06 with rapid-mlx 0.15.6, Claude Code 2.1.291 and qwen3.5-4b-4bit on a Mac mini (M2 Pro, 32 GB). Both routes, agents claude-code --setup and the two environment variables alone, edited the file through Claude Code's own tools in about a minute. Most of that minute is the model reading Claude Code's large system prompt and tool list.

Claude Code may print a notice that auto mode's classifier requests can't use a new billing path through a custom base URL. It's informational: nothing breaks.

What to expect

A model on your Mac isn't Claude Opus. Local shines for private work, codebase questions, and straightforward edits and refactors. The hardest multi-step reasoning and the longest contexts are still the cloud's strength. You don't have to choose: unset the two variables (or remove the env block) and Claude Code is back on Anthropic's models.

Frequently asked questions

Can Claude Code use a local model?

Yes. Claude Code reads ANTHROPIC_BASE_URL. Point it at a Rapid-MLX server (http://localhost:8000), which serves the Anthropic Messages API, and Claude Code runs on the model on your Mac. rapid-mlx agents claude-code --setup writes this into Claude Code's settings for you. Rapid-MLX itself sends anonymous usage counts by default, never prompts or code; rapid-mlx telemetry off turns that off (details).

Why doesn't ANTHROPIC_BASE_URL end in /v1?

The Anthropic client appends /v1/messages to the base URL itself. Use the server root, http://localhost:8000.

Which local model is best for Claude Code on a Mac?

16 GB: qwen3.5-4b-4bit fits 16 GB per the registry (not verified live on a 16 GB Mac), about 3 GB download. 18–36 GB: qwen3.5-9b-4bit default; start with qwen3.5-4b-4bit on 18–24 GB, about 6 GB or 3 GB download. 48 GB+: qwen3.5-9b-4bit responsive default; qwen3.8-27b-4bit higher-capability option, about 16 GB download and roughly 20–26 GB free unified memory required.

Where to go next


Run this yourself. Rapid-MLX is an open-source, OpenAI- and Anthropic-compatible inference server for Apple Silicon. One command installs it, then rapid-mlx serve <alias> serves any model on localhost:8000/v1.
curl -fsSL https://rapidmlx.com/install.sh | bash

New models and speedups, in your inbox

A short note whenever Rapid-MLX gets faster or adds models worth running on your Mac. No spam — unsubscribe anytime.