Skip to Content

llama.cpp on Apple Silicon

llama.cpp Apple Silicon support via the Metal backend makes it the default local inference stack for Mac developers. Unified memory means weights and KV cache compete with the OS — sizing differs from discrete-GPU Linux boxes.

Hub: llama.cpp. Memory and quant details: Memory & GGUF.

Why Metal matters

PropertyApple Silicon + llama.cppDiscrete GPU Linux
MemoryUnified — shared with OSDedicated VRAM
BackendMetal (-ngl 99 typical)CUDA
DependenciesMinimal — no NVIDIA stackCUDA drivers required
Best fitSolo dev, air-gapped laptopDatacenter batching

RAM-based model picks

Mac RAMPractical model rangeNotes
8 GB3B–7B Q4 onlyTight — watch memory pressure
16 GB7B–8B Q4; 13B Q4 marginalDefault dev Mac tier
32 GB+13B–14B Q4/Q5; 34B Q4 experimentalAgent loops viable

Monitor Memory Pressure in Activity Monitor during sustained agent sessions — swap kills interactive latency.

Server on Mac

./llama-server \ -m models/llama-3.2-8b-instruct.Q5_K_M.gguf \ --host 127.0.0.1 --port 8080 \ -ngl 99 \ -c 8192 \ --fit on \ --fit-target 2048

Bind 127.0.0.1 unless you explicitly need LAN access. Full server guide: Server mode.

Use --fit-target to leave headroom for Xcode, browsers, and IDE indexing — unified memory is not “free VRAM.”

Thermal and session caps

M-series chips throttle under sustained load:

  • Long agent loops heat the chassis — latency spikes after 10–20 minutes
  • Set session caps in your IDE (Cursor, OpenCode)
  • Prefer shorter context (-c) to reduce memory bandwidth load
  • Pause between heavy batch jobs

vs Ollama on Mac

Ollama wraps llama.cpp with ollama pull ergonomics. Go direct to llama.cpp when you need explicit GGUF paths, --fit-target control, or minimal dependencies without Ollama’s daemon.

Last updated on