How to Run a Local LLM on macOS with Ollama
By the end of this guide, Llama 3.1 8B will be answering questions from your Mac’s Terminal — no cloud account, no API key, no Docker. Ollama does the heavy lifting: one app, one pull command, and a local API on port 11434.
The headline number up front: on a 16 GB Mac mini M4, Llama 3.1 8B Q4_K_M decodes at about 21 tokens per second. A community benchmark measured 20.95 ± 0.02 tok/s with prompt processing at 229 tok/s — roughly 86% of the M4’s 120 GB/s memory-bandwidth ceiling. That is the speed you should expect from any 16 GB M-series Mac.
Requirements
- macOS Sonoma (v14) or later — the official floor.
- Apple M-series (M1 and up): runs on CPU and GPU through Metal, using unified memory. x86 Macs: CPU only — there is no CUDA path on macOS.
- 4 GB of disk for the app, plus room for models (the 8B default is a 4.9 GB download).
- Homebrew is optional, not required.
1. Install the Ollama app (or Homebrew)
App route: download ollama.dmg from ollama.com, mount it, and drag Ollama.app into /Applications. On first launch the app prompts to create the CLI symlink in /usr/local/bin — allow it, and ollama becomes available in Terminal.
Homebrew route:
brew install ollama
As of October 2026 the Homebrew stable is 0.40.11 — the latest release, published 2026-10-24. The formula depends on mlx-c 0.7.0 and ships a bottle for Apple Silicon. To run the server as a background service instead of the GUI app:
brew services start ollama
Models and config live in ~/.ollama; server logs in ~/.ollama/logs (server.log).
2. Fix the Gatekeeper “damaged” error if it appears
A first launch straight from the browser download can be blocked by macOS Gatekeeper:
Ollama.app is damaged and can’t be opened.
The app is not damaged — it carries a quarantine attribute. Remove it:
xattr -d com.apple.quarantine /Applications/Ollama.app
Then launch Ollama.app again. If you installed via Homebrew, this step does not apply.
3. Start the server and verify port 11434
The app runs a background server automatically; ollama ps in Terminal talks to it:
ollama ps
An empty table means the server is up and nothing is loaded. The API listens on http://localhost:11434. If the port is taken — the classic macOS failure is a leftover LaunchAgent that respawns the server — check:
launchctl list | grep -i ollama
lsof -i :11434
Empty lsof output means the port is free. Or run on another port:
OLLAMA_HOST=127.0.0.1:11435 ollama serve
4. Pull and run llama3.1:8b
ollama pull llama3.1:8b
ollama run llama3.1:8b
That is a 4.9 GB Q4_K_M file — the GGUF behind Ollama’s tag is 4,920,739,232 bytes, about 4.58 GiB. For multi-line input, wrap the text in """.
5. Check ollama ps and the context
ollama ps
The columns are NAME, ID, SIZE, PROCESSOR, UNTIL. In PROCESSOR you want 100% GPU — on an M-series Mac that means the model runs on unified memory through Metal. The default context is 4,096 tokens; raise it in-session with /set parameter num_ctx 8192, or server-wide with OLLAMA_CONTEXT_LENGTH=8192 ollama serve. To let other devices on your LAN reach the server: launchctl setenv OLLAMA_HOST "0.0.0.0:11434", then restart the app.
What to expect
All figures below come from one community benchmark — Mac mini M4, 16 GB, Llama 3.1 8B Q4_K_M (bartowski GGUF), September 2026:
| Setup | Decode | Prompt (pp512) | Resident memory |
|---|---|---|---|
| llama.cpp Metal | 20.95 ± 0.02 tok/s | 229.23 tok/s | 6.1 GB at 8K ctx |
| Ollama 0.34.2, same file | ~21 tok/s | — | — |
| CPU only (no Metal) | 14.67 tok/s | 23.42 tok/s | — |
Context is the second dial. At 16K context the machine stays swap-free; at 32K it swaps 0.95 GiB; at 64K it swaps 3.5 GiB and decode drops about 30%. Keep the context near 8K–16K on a 16 GB Mac. For reference, a 10-core M4 running a 7B Q4_0 reports 221.29 tok/s prompt / 24.11 tok/s decode in a llama.cpp discussion.
Troubleshooting
“Ollama.app is damaged and can’t be opened.” — Gatekeeper quarantine, not file corruption. Run xattr -d com.apple.quarantine /Applications/Ollama.app, then relaunch.
Error: listen tcp 127.0.0.1:11434: bind: address already in use — a second Ollama already holds 11434, and on macOS the LaunchAgent respawns it, so killing the process is not enough. Check launchctl list | grep -i ollama and lsof -i :11434; stop the extra server, or run on another port with OLLAMA_HOST=127.0.0.1:11435 ollama serve.
“no kernel image is available” — a compute-capability/driver mismatch. On Apple Silicon this string should not appear — there is no CUDA on macOS. If you see it on an x86 Mac, something is targeting a GPU the machine does not have; the official floor for CUDA cards is compute capability 5.0+ with a 550-series driver, which does not apply to Macs.
Answers are slow — confirm 100% GPU in ollama ps. A mixed split like 48% CPU / 52% GPU means the model plus KV cache no longer fit and part of the work falls back to the CPU.
FAQ
Does Ollama on Mac use the Apple Silicon GPU?
Yes, on M-series Macs the model runs on unified memory through the Metal backend, and the PROCESSOR column in ollama ps shows it. Intel Macs are CPU-only — Ollama has no CUDA path on macOS. The M4 benchmark above measured 14.67 tok/s CPU-only for the 8B Q4; older Intel chips are slower.
Where does Ollama store models on macOS?
~/.ollama — models, config, and logs (~/.ollama/logs/server.log). To remove everything: quit the app, then sudo rm -rf /Applications/Ollama.app, sudo rm /usr/local/bin/ollama, rm -rf ~/Library/Application\ Support/Ollama, and rm -rf ~/.ollama.
Can other devices on my network use the Mac’s Ollama?
Yes. Run launchctl setenv OLLAMA_HOST "0.0.0.0:11434", restart the app, and point clients at http://<mac-ip>:11434.
Is Ollama as fast as running llama.cpp directly on Mac? In the community benchmark, yes: Ollama 0.34.2 on the same 8B Q4_K_M file hit the same ~21 tok/s as a direct llama.cpp Metal build. Ollama’s backend is llama.cpp.
That covers the full macOS path. If you are coming from Windows, the Ollama on Windows guide walks the same five steps on the other OS, and the Ollama software review covers features this guide skips. To size your card before pulling anything bigger, use the VRAM calculator, and for the full model lineup see the Local LLMs pillar.
Sources
- Ollama docs — macOS — Sonoma floor, M-series/x86 support, DMG install, symlink prompt,
~/.ollamapaths, uninstall. - Homebrew — ollama formula —
brew install ollama, stable 0.40.11,mlx-c 0.7.0dependency,brew services start ollama. - ollama/ollama GitHub releases — v0.40.11, published 2026-10-24.
- ollama/ollama README — “Supported backends: llama.cpp”, the REST endpoint, client libraries.
- Ollama docs — FAQ — default 4096 context,
OLLAMA_CONTEXT_LENGTH,ollama pscolumns,launchctl setenv OLLAMA_HOSTfor LAN access. - localaimaster — Run Llama 3 on Mac — the exact Gatekeeper “damaged” string and the
xattr -d com.apple.quarantinefix (October 2025). - ollama/ollama #14511 — the
bind: address already in useerror on macOS and the LaunchAgent respawn behavior. - picklog — Llama 3.1 8B on Mac mini M4 — the measured numbers: 20.95 tok/s Metal, 229.23 pp512, 6.1 GB resident, swap behavior by context (September 2026).
- ggml-org/llama.cpp discussion #4167 — 10-core M4, 7B Q4_0: 221.29 tok/s prompt / 24.11 tok/s decode.