The best local LLM for coding on a Mac.

A coding model on your own Mac keeps your code private and works offline. What you can run comes down to memory, and how pleasant it is to use comes down to speed and context. Here are the open coding models that run well at each memory size, worked out from their model cards and Apple's specs, and how to plug them into your editor or agent.

Updated

The short version

  • 16 GB: only small general models run comfortably; Qwen3 Coder 30B A3B fits only at a lower precision. 24 GB: Devstral Small 2 (24B). 32–64 GB: Qwen3 Coder 30B A3B and Devstral Small 2 at 4-bit.
  • 96 GB and up: Qwen3 Coder Next (80B, 3B active). 128 GB: Devstral 2 (123B) too, slowly. 512 GB: Kimi K2.7 Code, at a low precision.
  • Mixture-of-experts coders read only a few billion weights per token, so Qwen3 Coder 30B A3B can write several times faster than the dense Devstral Small 2 on the same Mac.
  • Coding agents send long prompts: leave several gigabytes for the context, and check how much RAM an LLM needs.

1Coding models that run well, by memory

"Runs well" means it fits at 4-bit or better with room for context, at 10 or more tokens a second, the same rule as every Mac page. Models made for code from our catalog of open models, plus the general model with the highest Artificial Analysis Intelligence Index that runs well at that size, which also writes code:

Mac memoryMade for codeStrongest general model
16 GBQwen3 Coder 30B A3B only at a lower precisionMiniCPM5 2B
24 GBDevstral Small 2MiniCPM5 2B
32 GBQwen3 Coder 30B A3B, Devstral Small 2Qwen3.8 27B
48 GBQwen3 Coder 30B A3B, Devstral Small 2Qwen3.8 27B
64 GBQwen3 Coder 30B A3B, Devstral Small 2Qwen3.8 27B
96 GBQwen3 Coder Next, Qwen3 Coder 30B A3B, Devstral Small 2Qwen3.8 27B
128 GBQwen3 Coder Next, Devstral 2 (123B) (slower)Qwen3.8 27B
256 GBQwen3 Coder Next, Devstral 2 (slower)Qwen3.8 Flash Next
512 GBKimi K2.7 Code at a lower precision, Qwen3 Coder NextDeepSeek V4.1 Flash 1017
From the Compare catalog on 23 October 2026: parameters from each official model card, Intelligence Index from Artificial Analysis. The Intelligence Index measures general ability, not coding alone. Each size links to its full, current list.

2Why mixture-of-experts coders feel fast

Writing speed is limited by how many bytes of weights are read for each token. A dense model reads all of them; a mixture-of-experts model reads only its active part. On a Mac mini with M5 Pro (307 GB/s, Apple), at 4-bit:

ModelParametersRead per tokenCeiling for one chat
Qwen3 Coder 30B A3B30.5B total, 3.3B activeabout 1.9 GBabout 165 tokens/s
Devstral Small 224B, denseabout 13.5 GBabout 23 tokens/s
Parameters from the Qwen and Mistral model cards. Ceilings are bandwidth divided by bytes per token; real runs usually reach about 45% to 80% of them. Estimates, not measurements.

Speed isn't quality: a dense model can be the better coder at the same memory. Try both on your own code.

3Leave room for context

Coding tools send a lot of text: the files in play, tool descriptions and the conversation so far. That context is held in memory next to the model, in the KV cache, and it grows with every token. For Qwen3 8B, 32,000 tokens take about 4.8 GB (worked out here). Larger models need more per token.

So when a model only just fits, pick the next smaller one, or a lower precision, rather than squeezing the context. Long prompts also take time to read before the first word appears; the M5 generation reads prompts faster than M4 (Apple).

4Use it in your editor or agent

Coding tools talk to a model through an API. Run the model locally and point the tool at it:

  • LM Studio's local server speaks the OpenAI and Anthropic formats, and LM Studio has set-up guides for Claude Code, Codex, OpenClaw and Hermes Agent (LM Studio).
  • mlx-lm: mlx_lm.server --model <model> serves an OpenAI-style API on port 8080 (mlx-lm).
  • Ollama serves an OpenAI-compatible API too: the best apps to run LLMs on a Mac compares them.

Agents call tools, so the model has to produce tool calls in a format the server understands. Models made for code and agents, such as Qwen3 Coder and Devstral, are trained for it; small general models often aren't reliable at it.

The AI App Store's coding category lists coding agents and editors, such as Claude Code and Codex, each with its maker's official download, price and where your data goes.

5Questions

What is the best local coding LLM for a 32 GB Mac?
Qwen3 Coder 30B A3B and Devstral Small 2 both run well at 4-bit. Qwen3 Coder writes much faster because only 3.3B of its 30.5B parameters are read per token; try both on your own code.
Can a 16 GB Mac run a coding model?
Small models, yes. Qwen3 Coder 30B A3B fits in 16 GB only at a lower precision, with little room for context. For coding agents, 32 GB or more is a better start.
Can I use Claude Code or Codex with a local model?
Yes. LM Studio has set-up guides for both: its local server speaks the Anthropic format Claude Code uses and the OpenAI format Codex uses (LM Studio). How well they work depends on the model you load.
Is a local coding model as good as a cloud one?
The biggest open models come close on many tasks, but they need a Mac Studio with 256 or 512 GB. Models that fit 32–64 GB are useful for completion, explanations and smaller agent tasks, and keep your code on your Mac.

Sources

  1. Artificial Analysisartificialanalysis.ai
  2. Applesupport.apple.com
  3. Qwenhuggingface.co
  4. Mistralhuggingface.co
  5. Applemachinelearning.apple.com
  6. LM Studiolmstudio.ai
  7. mlx-lmgithub.com
  8. LM Studiolmstudio.ai

Read next