Claude Code Local: Run Claude Code With Local AI on Apple Silicon

Run Claude Code with local models on a 16 GB to 128 GB Mac. Compare Hermes, Gemma, Qwen, Llama, and DeepSeek routes, plus the optional native agent.

Claude Code Local is an MIT-licensed local AI backend for running Claude Code with open-weight models on an Apple Silicon Mac. You keep the familiar Claude Code workflow for reading files, editing code, running commands, and using MCP servers while an MLX-native server handles model inference on your Mac.

The server speaks the Anthropic API directly. Claude Code sends requests to localhost:4000, and the server translates model-specific tool calls into the format Claude Code expects. This single-process design removes the extra translation proxy found in many local setups and reduces prompt-processing overhead.

Your Mac’s unified memory sets the practical model range. A 16 GB Mac can start with Hermes 4 14B, while Macs with more memory can run Gemma, Qwen, Llama, Muse-Glimmer, or DeepSeek routes.

Claude Code Local also includes an optional native agent for faster long sessions. It loads the same MLX models in process, uses a compact stable prompt, and preserves reusable prompt-cache state across turns.

Features

  • Runs open-weight models through an MLX-native server that implements the Anthropic Messages API.
  • Preserves Claude Code file, shell, search, edit, permission, project-instruction, and MCP workflows.
  • Translates Gemma, Llama, Qwen, and related tool-call formats into Anthropic tool_use blocks.
  • Repairs malformed tool calls and retries detected tool intent up to two times.
  • Reuses the shared prompt prefix across turns and trims each cache to the correct conversation boundary.
  • Provides an optional native MLX agent with Bash, Read, Write, Edit, Glob, and Grep operations.
  • Publishes the Agent-12 benchmark with open tasks, judges, and a reproducible runner.
  • Includes launchers for Claude Code, the native agent, browser control, hands-free voice, and phone access.
  • Supports models from about 8 GB to 81 GB, with setup choices for 16 GB through 128 GB Macs.

Use Cases

  • Continue routine Claude Code work after reaching a hosted usage limit.
  • Inspect private source code and legal or internal documents through local model inference.
  • Trace a failing test, edit the affected files, and run the test command from a terminal agent.
  • Use a 16 GB Mac for code explanations, contained fixes, scripts, and focused tool-driven tasks.
  • Run larger local coding models on a high-memory Mac for repository searches and longer agent sessions.

How to Use Claude Code Local

Install the Local Backend

Claude Code Local requires an Apple Silicon Mac, Python 3.12 or later, enough storage for the selected model, and a current Claude Code binary. Install Claude Code first, then run the repository installer:

curl -fsSL https://claude.ai/install.sh | bash
curl -fsSL https://raw.githubusercontent.com/nicedreamzapp/claude-code-local/main/install.sh | bash

The installer detects unified memory, selects a starter model, installs the MLX environment, downloads the weights, and creates Claude Local.command on the Desktop. Model downloads range from about 8 GB for Hermes 4 14B to about 81 GB for the two-bit DeepSeek V4 Flash route.

You can inspect the repository before running its setup script:

git clone https://github.com/nicedreamzapp/claude-code-local
cd claude-code-local
bash setup.sh

Start a Claude Code Session

Open Claude Local.command. The launcher starts the local server, points Claude Code at http://localhost:4000, and supplies the local authentication values. Enter a focused coding task from the project directory and review each requested file or command permission.

Choose a Model for Your Mac

Start with the automatic selection, then use the published benchmark results to test a stronger route that fits your memory. Keep enough free unified memory for macOS, Claude Code, the KV cache, and active project operations.

Unified MemoryPractical Starting RouteModel Footprint or Role
16 GBHermes 4 14BAbout 8 GB; focused coding and tool use
32 to 48 GBGemma 4 12BSmaller daily coding route
64 to 95 GBGemma 4 31B or Qwen3.6-35B-A3BLonger sessions and stronger agent tasks
96 GB or moreQwen 3.8 27B bf16, Qwen 3.5 122B, or Llama 3.3 70BLarge dense or MoE models
128 GB or moreDeepSeek V4 FlashAbout 81 GB at two-bit; long-context route

Run the Native Agent

The native agent loads an MLX model in the same process as the agent loop. Its compact fixed prompt keeps the reusable prefix stable during long conversations. Launch a supplied Native Engine command file or run:

AGENT_MODEL=lmstudio-community/Qwen3-Coder-30B-A3B-Instruct-MLX-8bit \
AGENT_DIALECT=native \
python3 agent/agent.py

Use AGENT_DIALECT=native for a model with a reliable native tool-call template. Set AGENT_DIALECT=prompted when the model needs the XML tool format defined in the system prompt. The native route provides its own terminal interface and does not load the Claude Code harness.

Agent-12 Model Benchmarks

Agent-12 evaluates completed filesystem work in a fresh sandbox for every task. It uses fixed token caps, temperature zero, and judges checked against known good and bad solutions. The score comes from the required files and behavior.

ModelTask ResultsHard-Suite Time
Qwen3.6-35B-A3B, MLX 8-bit12/12 easy; 8/8 hard125 seconds
Qwen3-Coder-30B-A3B, MLX 8-bit12/12 easy; 7/8 hard392 seconds
Gemma 4 31B, MLX 4-bit11/12 easy; 8/8 hard348 seconds
DeepSeek V4 Flash, two-bit ds412/12 easy; 8/8 hard551 seconds

Claude Code Route vs Native Engine

Both routes run local MLX models and provide file and shell operations. The Claude Code route keeps Claude Code commands, permissions, project instructions, and MCP compatibility. The native engine focuses on a smaller stable prompt and direct cache control for lower local latency.

AreaClaude Code RouteNative Engine
InterfaceClaude Code terminal agentRepository’s own terminal agent
PromptClaude Code harness with local reductionsAbout 550 stable system tokens
IntegrationsClaude Code permissions, commands, and MCP serversBash, Read, Write, Edit, Glob, and Grep
Long-session latencyDepends on harness and cache reuse0.36-second first token in the published 4.5K-context Gemma test
Best fitExisting Claude Code projects and integrationsFast local coding sessions with the included operations

Alternatives and Related Resources

Pros

  • Licensed under the MIT.
  • Local model inference has no per-token API charge.
  • Agent-12 supplies reproducible task results for model selection.
  • The 16 GB Hermes route supports focused coding tasks on a base MacBook.

Cons

  • Requires an Apple Silicon Mac.
  • Model weights consume about 8 GB to 81 GB of storage.
  • Local-model accuracy varies by model, cache precision, prompt length, and task complexity.

FAQs

Q: Does Claude Code Local support Intel Macs, Windows, or Linux?
A: The included MLX server and launchers target Apple Silicon Macs. The repository does not provide an equivalent Intel, Windows, or Linux inference path.

Q: Why does the launcher show a Claude sign-in prompt?
A: The local launchers rely on current Claude Code support for the bare local route. Upgrade Claude Code with npm install -g @anthropic-ai/claude-code@latest, then reopen the launcher.

Q: What does an ablated model change?
A: Abliteration suppresses a model’s learned refusal direction. It does not increase general reasoning ability, and each upstream model license continues to apply.

Q: How can I reproduce the published results?
A: The Agent-12 tasks, judges, runner, and judge-validation checks are available in the public Agent-12 repository. The native-agent cache test runs through python3 bench/agent_bench.py.

Changelog

  • August 23, 2026: Current checkouts correct cross-session prompt-cache state, use Hermes 4 14B as the 16 GB starting route, and include the native agent path.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!