← Notes

Getting Started: Running Local Models on a Mac

Ollama on an M4 Max with 36 GB of unified memory: install in two commands, keep models on an external drive, and find out how much context actually fits. Qwen3.6 35B-A3B runs at 106 tok/s and handles about 85K tokens of context before it runs out of memory.

The short version

Everything in our earlier local-model posts ran on one Windows box with an RTX 5070 (12 GB of VRAM). This is the same setup on a MacBook with an M4 Max and 36 GB of unified memory, from an empty machine to a working coding model in about fifteen minutes, most of it download time.

EngineOllama 0.40.8, installed with Homebrew
Coding modelqwen3.6:35b-a3b-coding, 23 GB, 106 tok/s
General / vision modelgemma4:12b, 7.7 GB, 66 tok/s
Usable context (Qwen3.6)~85K tokens; 64K is the safe default
Where the models liveAn external NVMe drive, via a symlink

Every number here was measured on this machine. Quality claims are not ours; see Bakeoff for how we test those.

1. Install Ollama

brew install ollama
brew services start ollama

That’s it. The service starts at login and serves the same OpenAI-compatible API as on Windows, at http://localhost:11434. Check it with:

ollama --version
curl localhost:11434/api/version

There’s no driver to install and no GPU to detect. On Apple Silicon, Ollama picks its MLX engine automatically; ollama ps shows mlx in the RUNNER column and 100% GPU in PROCESSOR.

If you’d rather have a menu-bar app, the Ollama desktop app works too. We use the Homebrew service because it’s one command and easy to script.

2. (Optional) Keep models on an external drive

Models are large: the two here take 29 GB, and it adds up fast. If the internal disk is tight, move the model store to a fast external drive and leave a symlink behind:

brew services stop ollama
mkdir -p /Volumes/MyDrive/ollama
mv ~/.ollama/models /Volumes/MyDrive/ollama/models
ln -s /Volumes/MyDrive/ollama/models ~/.ollama/models
brew services start ollama

The drive is only read when a model loads into memory. After that everything runs from RAM, so a fast NVMe drive costs a few seconds per load and nothing during generation.

We use a symlink rather than the OLLAMA_MODELS variable because Homebrew regenerates its service file on upgrades, which drops custom environment variables. The one catch: if the drive isn’t plugged in, Ollama sees no models, and pulls fail instead of quietly filling the internal disk.

3. Pull a couple of models

ollama pull qwen3.6:35b-a3b-coding   # 23 GB — coding, tools, long context
ollama pull gemma4:12b               # 7.7 GB — quick answers, reads images
ollama run gemma4:12b "Say hi in five words."

Why these two:

  • Qwen3.6 35B-A3B (coding build) is a mixture-of-experts (MoE) model: 35B parameters in total, but only about 3B are used for each token. That makes it fast for its size, and it was the top candidate in our 12 GB rerun. It also has built-in speculative decoding (it drafts tokens ahead and checks them), which helps generation speed.
  • Gemma 4 12B is a small dense model that also reads images. It’s good for quick questions and for anything with a screenshot in it.
ModelShort-prompt generationMemory loaded
qwen3.6:35b-a3b-coding106 tok/s23 GB
gemma4:12b66 tok/s7.9 GB

The bigger model is the faster one. A dense 12B model reads all 12B parameters for every token, and the MoE reads about 3B. On a Mac, generation speed mostly comes down to how many bytes each token has to read from memory.

What’s different from a 12 GB GPU

On the 5070, the deciding question was whether a model fits in 12 GB of VRAM. Anything larger spilled into system RAM over PCIe, which only worked for MoE models. A Mac doesn’t have that split: the GPU uses the same memory as everything else. By default macOS lets the GPU use about three quarters of it, and Ollama reported 28.1 GiB available on this 36 GB machine.

So the questions change:

  • Dense models up to ~20 GB are usable here. They’re slower than MoE models, but nothing gets split between the GPU and CPU.
  • Only one big model at a time. Qwen3.6 (23 GB) plus anything sizable won’t fit together, so Ollama unloads one to load the other, which costs a few seconds each switch.
  • Context length is now the real limit.

How much context fits

Coding agents fill context quickly, and a small window is a common reason a local model seems to get dumber partway through a task. We filled Qwen3.6 with real text (posts and scripts from our own repos) at increasing context sizes:

Context settingPromptPrompt processingGenerationPeak memory
32K29K tokens1,042 tok/s (28 s)63 tok/s27.1 GiB
64K60K tokens724 tok/s (83 s)62 tok/s30.6 GiB
96K85K tokens547 tok/s (156 s)56 tok/s31.8 GiB
128K~120K tokens——out of memory

Two things stand out.

Generation barely slows down; memory is the limit. The weights take 22 GiB and the context cache stays small, about 1 GiB per 30K tokens on this model. The trouble is a temporary spike while a long prompt is processed, which reached 5–7 GiB here. Peaks went past the 28.1 GiB Ollama reported, up to about 32 GiB, before Metal gave up. We also grew a conversation turn by turn at a 128K setting, the way an agent does. It worked through 79K tokens and ran out of memory around 100K.

Long prompts are slow to start, but only once. Processing 85K tokens from scratch took two and a half minutes. Ollama caches what it has already processed, though: resending the same 15K-token prompt took 0.02 s instead of 12 s, and in a multi-turn chat each turn only paid for the new text. An agent pays the full cost once per session, not once per step.

So we set up a 64K variant as the everyday default. It shares the same weights and takes no extra disk:

printf 'FROM qwen3.6:35b-a3b-coding\nPARAMETER num_ctx 65536\n' > Modelfile
ollama create qwen3.6-coding:64k -f Modelfile

Point your tools at qwen3.6-coding:64k. If you need more and are watching memory, 96K worked in our tests with about 10K tokens to spare. Expect to run out of memory somewhere past that.

Seeing what it’s doing

The first time you run a long prompt you might open Activity Monitor and see almost nothing, which is confusing. The work is on the GPU, and the model’s memory is counted as wired memory rather than against the Ollama process. Instead:

  • Window → GPU History (⌘4) shows the GPU at 95–100% during a run.
  • In the Memory tab, look at Wired Memory and Memory Pressure at the bottom, not the per-process list. Our 128K test pushed wired memory to 32 GB, with 9% free.
  • ollama ps shows what’s loaded, its context size, and whether any of it spilled to the CPU.

Next

Speed and memory are the easy part. The open question is whether qwen3.6-coding:64k does good work on real tasks, and whether a slower dense model like Qwen3.8 27B, which fits on this Mac but not the 5070, is worth the wait. That’s a job for a bakeoff.