AI

Ollama vs LM Studio vs MLX on Mac: Tested on M4 24 GB

If you run local models on a Mac, you are choosing between Ollama, LM Studio and mlx-lm. The usual advice (“Ollama for convenience, MLX for speed”) no longer matches what we measured. On a 24 GB M4 Mac mini, the default Ollama qwen3.5:9b tag generated 27.3 tokens per second. On one identical MLX file, mlx-lm managed 21.3 and LM Studio 20.1, so the winner is not the MLX engine itself.

Original content from computingforgeeks.com - post 181447

For most people the pick is Ollama, and the reason is speculative decoding. Its MLX runner drafts tokens with the multi-token prediction head built into Qwen3.5, and that is where your extra speed comes from. We ran all three on the same Qwen3.5 9B model with identical prompts, a 400-token budget and three timed runs per cell, then pushed a 27B model into the Metal memory limit to see where 24 GB runs out. Every number below was measured on that Mac in November 2026.

Ollama vs LM Studio vs MLX benchmark results

Each cell holds the median of three runs. “Short” is a 40-token prompt, “long” is a 1,663-token prompt built from a man page, and both ask for 400 generated tokens at temperature 0. Prompt speed is shown for the long prompt only, because 40 tokens finish too fast to time prefill with any precision.

Runtime and modelFormat and engineOn diskPeak memory (short / long)Prompt t/s (long)Gen t/s (short)Gen t/s (long)
Ollama qwen3.5:9bNVFP4, MLX runner, MTP drafting7.6 GB7.85 / 9.68 GiB224.927.326.6
Ollama qwen3.5:9b-mlxNVFP4, MLX runner8.9 GB8.86 / 10.83 GiB236.316.115.4
Ollama qwen3.5:9b-q4_K_MGGUF Q4_K_M, llama.cpp runner6.6 GBnot logged216.217.117.1
LM Studio, MLX engine 1.13.14-bit MLX (lmstudio-community)5.98 GBnot reported230.920.120.7
LM Studio, llama.cpp engine 2.66.0GGUF Q4_K_M (lmstudio-community)6.55 GBnot reported215.717.517.3
mlx-lm 0.32.2Same 4-bit MLX file as LM Studio5.98 GB5.26 / 6.41 GB236.521.321.1

Read the rows in pairs, because that is where the comparison is fair, and three pairs tell you most of what you need.

  • Same file, two runtimes: LM Studio and mlx-lm loaded the same 5.98 GB folder. mlx-lm was 5.7% faster at generation (21.3 against 20.1) and within 2.5% on prefill.
  • Same format, two runtimes: the llama.cpp builds inside Ollama and LM Studio ran different Q4_K_M files and landed 2% apart, so the wrapper barely matters.
  • Same runtime, two formats: inside LM Studio, switching from GGUF to MLX lifted generation from 17.5 to 20.1 tokens/s. That 15% is the honest size of the MLX advantage on a base M4.

Two rows break the pattern. Ollama’s 9b-mlx tag is the slowest result on the page at 16.1 tokens/s even though it runs on MLX, and it’s also the largest file at 8.9 GB. The default 9b tag is the fastest at 27.3, and the next section shows why it is not a like-for-like engine comparison. Run-to-run spread stayed under 2% on most rows. The exceptions are the 9b-mlx long-prompt row (14.9 to 16.0 tokens/s) and the default tag, which moved between 24.8 and 28.4 tokens/s because its speed depends on how many drafted tokens the model accepts. The two Ollama MLX tags are different builds, too: the default reports 9.7B parameters and carries the drafting head, while 9b-mlx reports 9.4B and has none.

How we tested

All runs used one EC2 mac-m4.metal host, an M4 Mac mini with a 10-core CPU, a 10-core GPU and 24 GB of unified memory, running macOS 27.0 with no desktop session. Only one runtime held a model at a time, and the 1-minute load average ranged from 1.5 to 6.4 during the timed runs. This is how each number you see in the table was taken.

  • Generation tokens/s: the counter each runtime reports. For Ollama that’s eval_count over eval_duration, for LM Studio stats.tokens_per_second, and for mlx-lm the Generation: line.
  • Prompt tokens/s: prompt_eval_count over prompt_eval_duration in Ollama, the mlx-lm Prompt: line, and for LM Studio the prompt tokens divided by time_to_first_token, which includes a little API overhead.
  • Prompt handling: raw text completion with no chat template, so no runtime spent tokens on the Qwen3.5 thinking block. Each run prefixed “Run N.” to the prompt so no runtime could reuse a cached prompt.
  • Runs: one discarded warm-up, three timed runs, median reported. Some long-prompt runs stopped at an end-of-text token after 302 to 327 tokens, which changes the count but not the rate.
  • Peak memory: the highest memory peak line the Ollama MLX runner logged across the three timed runs, and the Peak memory line from mlx-lm. The Ollama figure crept up about 0.11 GiB per request, so a single reading understates it. lms ps only reports file size, and the Ollama llama.cpp runner logs no peak.

One shortcut needs disclosure. lms load rejected the variant key qwen/qwen3.5-9b@q4_k_m even though lms ls --variants listed it, so for the LM Studio GGUF row we moved the MLX folder out of ~/.lmstudio/models for that run. The desktop app picks variants from a dropdown, so you won’t need this there.

Does Ollama use MLX on a Mac?

Yes, for supported model families. The Ollama 0.40.0 release notes say that “on Apple Silicon devices, model architectures supported by the MLX runtime will automatically run on MLX”, and Qwen3.5 is on that list. On our M4, a plain ollama pull qwen3.5:9b fetched an NVFP4 build and ollama ps showed mlx in its RUNNER column. The explicit qwen3.5:9b-q4_K_M tag is a GGUF file, and the same column showed llamacpp for it.

ollama ps RUNNER column showing mlx for qwen3.5:9b and llamacpp for qwen3.5:9b-q4_K_M on an M4 Mac

So “Ollama is just llama.cpp” is out of date, and so is the opposite claim that Ollama now equals mlx-lm. Which engine you get depends on the tag you pull, and your speed depends on more than the engine. Glance at the CONTEXT column while you’re there: both models loaded with 4,096 tokens, which matches the “< 24 GiB VRAM: 4k context” tier in the Ollama context-length documentation. If your agent needs a longer context, you will have to raise it yourself.

Why the default qwen3.5:9b tag is faster

The default tag ships with draft_num_predict 3 in its parameters, and the Ollama Modelfile reference describes that setting as the number of speculative draft tokens per step for models with “embedded MTP tensors”. The server log confirms drafting on every run. A 400-token generation took about 160 iterations at an acceptance rate between 0.61 and 0.78, so each forward pass produced roughly 2.5 tokens instead of one, which accounts for most of the 6 tokens/s Ollama gains over mlx-lm.

We tried to switch it off to get a clean MLX number, and couldn’t. A Modelfile with PARAMETER draft_num_predict 0 built a model whose ollama show output read 0, yet it still generated at 25.5 tokens/s on the short prompt and the log kept printing draft statistics. Passing "draft_num_predict": 0 per request did the same (24.1 to 26.2 tokens/s). The docs say 0 disables drafting, so on 0.40.13 that setting did not behave as documented for this model, as the log below shows.

Ollama server log speculative decode stats for qwen3.5:9b still drafting with draft_num_predict set to 0

Speculative decoding is built to emit the tokens the full model would have picked anyway, so the faster tag is a real gain for you, not a benchmark trick. The gain shrinks on text the draft head predicts badly: a short chat answer later in this guide drafted at 0.55 acceptance and ran at 21.5 tokens/s, about the same as mlx-lm. LM Studio has a --speculative-draft-mtp load flag, but on the lmstudio-community 4-bit file it changed nothing you’d notice (20.6 against 20.1 tokens/s short, 20.9 against 20.7 long). Our script did not record LM Studio’s draft counters for that run, so we can’t say whether drafting engaged at all.

1. Ollama

Ollama wins on speed for Qwen3.5 and on everything you build around the model: a background service, an API on port 11434 and the widest client support. Homebrew offers two packages. The ollama-app cask is the menu bar app from the website, and the ollama formula is the CLI and server only, which suits a headless Mac mini. We used the formula (0.40.13):

brew install ollama

The launchd plist from the formula sets OLLAMA_FLASH_ATTENTION=1 and OLLAMA_KV_CACHE_TYPE=q8_0, so the service starts with a quantised KV cache. Starting it the usual way failed on our host, because brew services targets the gui/501 launchd domain and a Mac you only reach over SSH has no GUI login session:

brew services start ollama

Homebrew still wrote a working plist to ~/Library/LaunchAgents. Bootstrap it into the user domain instead, then check that the API answers. We did not reboot the host, so we can’t tell you whether this user-domain job comes back on its own after a restart of a Mac with nobody logged in; plan to re-run the bootstrap or test it on your own box.

launchctl bootstrap user/$(id -u) ~/Library/LaunchAgents/sh.brew.ollama.plist
curl -s localhost:11434/api/version

Below is the launchctl error 125 from brew services, then the silent bootstrap and the version reply.

brew services start ollama failing with launchctl error 125 on a headless Mac, fixed with launchctl bootstrap into the user domain

Pull the model and run one prompt with --verbose, so Ollama prints its timing block after the answer. --think=false skips the Qwen3.5 reasoning block, which is on by default:

ollama pull qwen3.5:9b
ollama run qwen3.5:9b --verbose --think=false "In three sentences, what does the Linux page cache do?"

The first load after a server restart took 75 seconds, so don’t judge speed by the total. The eval rate line is the one to compare, here 21.50 tokens/s over a 94-token answer:

ollama run qwen3.5:9b --verbose on an M4 Mac showing eval rate 21.50 tokens/s and a 75 second cold load

Run ollama ps while the model is loaded and check for 100% GPU under PROCESSOR. Any CPU share there means the model did not fit in GPU memory and your speed will collapse. Where Ollama falls short:

  • The MLX label isn’t the speed: its own 9b-mlx tag was the slowest MLX result we measured, so compare tags, not engines.
  • Drafting can’t be turned off: draft_num_predict 0 was ignored on 0.40.13, which matters if you need repeatable timings.
  • Structured output on the Homebrew build: the log printed Structured output is unavailable because libollama_xgrammar.dylib is missing from the bottle. We didn’t test JSON-schema output, so check it before you point an agent at this build.

Pick Ollama if you want one service that other tools can call. The flags and environment variables used here are collected in our Ollama commands cheat sheet.

2. LM Studio

LM Studio wins if you want a model browser and both engines behind one switch. The desktop app needs a logged-in desktop, so on the headless M4 we used llmster, which the LM Studio docs describe as its headless daemon. It uses the same lms CLI and installs the MLX and llama.cpp engine packs shown below. On a Mac you sit in front of, brew install --cask lm-studio gets you the app instead:

curl -fsSL https://lmstudio.ai/install.sh | bash
export PATH="$HOME/.lmstudio/bin:$PATH"
lms daemon up
lms runtime ls

On our host the installer printed Could not add lms to your PATH, which is why the second line adds it by hand. Put that export in ~/.zshrc so it sticks. Right after lms daemon up, lms runtime ls printed No runtimes found. because the daemon was still fetching its engine packs. A few minutes later it listed two engines, one per model format:

LM Studio llmster headless install on macOS, lms runtime ls showing no runtimes at first and then the MLX and llama.cpp engines

Download the MLX build of the model. --mlx limits the search to MLX files and -y accepts the default pick, which on our host was lmstudio-community/Qwen3.5-9B-MLX-4bit at 5.98 GB, fetched at about 99 MB/s:

lms get qwen/qwen3.5-9b --mlx -y

Ask for a memory estimate first, then load the model with a fixed identifier so API calls can name it, and start the server on port 1234:

lms load qwen/qwen3.5-9b --estimate-only -c 16384 -y
lms load qwen/qwen3.5-9b --identifier qwen3.5-9b -c 4096 -y
lms server start --port 1234
lms ps

Don’t lean on the estimate too hard. It printed 7.79 GiB with Confidence: LOW at a 16,384-token context and the same 7.79 GiB at 4,096 tokens, so it ignored the KV cache growing with context. The capture also shows the variant-key error from the method notes, right under the lms ls --variants listing that offers that key:

lms ls --variants listing q4_k_m and 4bit, lms load rejecting the q4_k_m variant key, and --estimate-only reporting 7.79 GiB at both 4k and 16k context

LM Studio reports the speed of each request in its REST API, so you don’t have to time anything by hand. Send a 200-token completion to /api/v0/completions and print the stats block:

curl -s localhost:1234/api/v0/completions -H "Content-Type: application/json" -d '{"model":"qwen3.5-9b","prompt":"The Linux page cache","max_tokens":200,"temperature":0}' | python3 -c 'import json,sys;d=json.load(sys.stdin);print(json.dumps({"stats":d["stats"],"usage":d["usage"],"runtime":d.get("runtime")},indent=2))'

The runtime block names the engine that served the request, which settles the MLX question for LM Studio as cleanly as RUNNER does for Ollama. The zero draft counts confirm no speculative decoding was active:

{
  "stats": {
    "tokens_per_second": 20.638871603401785,
    "time_to_first_token": 0.711,
    "generation_time": 9.642,
    "stop_reason": "maxPredictedTokensReached",
    "total_draft_tokens_count": 0,
    "accepted_draft_tokens_count": 0,
    "rejected_draft_tokens_count": 0,
    "ignored_draft_tokens_count": 0
  },
  "usage": {
    "prompt_tokens": 4,
    "completion_tokens": 199,
    "total_tokens": 203
  },
  "runtime": {
    "name": "mlx-llm-mac-arm64-apple-metal-advsimd",
    "version": "1.13.1",
    "supported_formats": [
      "safetensors"
    ]
  }
}

At 20.6 tokens/s, that single request is within 3% of the benchmark median, so you can trust the API number for quick checks of your own. Unload with lms unload --all before you test another runtime, since two resident 9B models split the 17.8 GiB GPU working set and skew the timings of both. Where LM Studio falls short:

  • Variant keys in the CLI: lms load refused the @q4_k_m and @4bit keys that lms ls --variants printed, so scripting a format switch is awkward.
  • A loose estimate: --estimate-only gave the same figure at 4k and 16k context, so it won’t warn you when a long context is what tips you over.
  • Slightly slower MLX: 5.7% behind mlx-lm on the identical file.

Pick LM Studio if you want to browse Hugging Face models in a window and flip between GGUF and MLX builds without touching Python.

3. mlx-lm

mlx-lm wins on memory and on raw MLX speed without drafting. It’s a Python package, and the obvious install failed on macOS 27. The Homebrew ollama formula from the previous section pulls in [email protected] as a dependency, uv picked it, and sentencepiece 0.2.2 has no Python 3.15 wheel on PyPI, so uv tried to build it from source and the build script exited with status 127:

brew install uv
uv tool install mlx-lm

PyPI has macOS arm64 wheels of sentencepiece for Python 3.9 through 3.14, and mlx-lm 0.32.2 needs 3.11 or newer. Pin the interpreter and uv downloads its own copy without touching the Homebrew one:

uv tool install --python 3.13 mlx-lm

Below, the failed build sits next to the pinned install that put 18 executables on your PATH (mlx_lm plus 17 mlx_lm.* commands).

brew deps ollama pulling python@3.15, then uv tool install mlx-lm failing to build sentencepiece 0.2.2 and succeeding with --python 3.13

Given a repository name, mlx-lm downloads into the Hugging Face cache, not into LM Studio’s folder, so the command below fetches the same 6 GB again unless you already have it there (we had pulled it into the cache separately). To reuse the LM Studio copy, pass its path, ~/.lmstudio/models/lmstudio-community/Qwen3.5-9B-MLX-4bit, as the benchmark script does. Unlike the benchmark, mlx_lm.generate applies the chat template by default, and Qwen3.5 starts with a thinking block that can eat the whole 400-token budget:

mlx_lm.generate --model lmstudio-community/Qwen3.5-9B-MLX-4bit --prompt "In three sentences, what does the Linux page cache do?" --max-tokens 400

Those three stats lines at the end are what mlx-lm is good for. Generation ran at 20.846 tokens/s with a 5.236 GB peak, well under what the Ollama runner logged for this model:

mlx_lm.generate with Qwen3.5 9B 4-bit on an M4 printing 20.846 tokens-per-sec and 5.236 GB peak memory

On the short benchmark prompt mlx-lm peaked at 5.26 GB, against 7.85 GiB (about 8.4 GB) for the default Ollama tag, and that gap is the practical reason to keep mlx-lm around on 24 GB. It leaves you roughly 3 GB more for the KV cache or a second process. Where mlx-lm falls short:

  • You own the Python: the Python 3.15 failure above is the kind of thing Ollama and LM Studio never show you.
  • No service by default: each mlx_lm.generate call loads the model again, and nothing restarts a server after a reboot unless you write the launchd job.

Pick mlx-lm if memory is tight or you want the reference MLX numbers for a new model before the GUI tools catch up.

Reproduce the benchmark on your Mac

One Python script produced the table. It talks to the Ollama and LM Studio APIs, calls mlx_lm.generate, and uses only the standard library, so you don’t need extra packages. We ran it with the Homebrew python3 (3.15.2) that the ollama formula installed. Create your working directory and the long prompt first, which is the first 7,000 characters of the launchd.plist man page plus a summarise instruction:

mkdir -p ~/ollama-lm-studio-mlx-mac && cd ~/ollama-lm-studio-mlx-mac
(man -P cat launchd.plist 2>/dev/null | col -b | tr -s " \n" | head -c 7000; printf "\n\nSummarize the document above in five bullet points.\n") > long-prompt.txt

Open a new file for the script:

vim ~/ollama-lm-studio-mlx-mac/bench.py

Paste the script exactly as it ran on the M4. MLX_PATH points at the folder LM Studio downloaded, which is how mlx-lm and LM Studio shared one file:

import json, os, re, statistics, subprocess, sys, time, urllib.request

W = os.path.expanduser("~/ollama-lm-studio-mlx-mac")
ENV = dict(os.environ, PATH="/opt/homebrew/bin:%s/.local/bin:%s/.lmstudio/bin:/usr/bin:/bin:/usr/sbin:/sbin" % (os.environ["HOME"], os.environ["HOME"]))
SHORT = "Explain how the Linux page cache decides which pages to evict under memory pressure. Cover the active and inactive LRU lists, dirty page writeback and the role of swappiness."
LONG = open(os.path.join(W, "long-prompt.txt")).read()
GEN = 400
RUNS = 3
MLX_PATH = os.path.expanduser("~/.lmstudio/models/lmstudio-community/Qwen3.5-9B-MLX-4bit")
OUT = os.path.join(W, "bench-results.jsonl")


def post(url, body, timeout=900):
    req = urllib.request.Request(url, data=json.dumps(body).encode(), headers={"Content-Type": "application/json"})
    t0 = time.time()
    with urllib.request.urlopen(req, timeout=timeout) as r:
        d = json.load(r)
    return d, time.time() - t0


def sh(cmd):
    return subprocess.run(cmd, shell=True, env=ENV, capture_output=True, text=True).stdout


def load_snapshot():
    return sh("sysctl -n vm.loadavg").strip()


def ollama(model, prompt, i):
    d, wall = post("http://127.0.0.1:11434/api/generate", {
        "model": model, "prompt": "Run %d. %s" % (i, prompt), "raw": True, "stream": False,
        "options": {"num_predict": GEN, "temperature": 0, "seed": 42}})
    return {"prompt_tokens": d["prompt_eval_count"], "prompt_tps": d["prompt_eval_count"] / (d["prompt_eval_duration"] / 1e9),
            "gen_tokens": d["eval_count"], "gen_tps": d["eval_count"] / (d["eval_duration"] / 1e9), "wall_s": wall}


def lmstudio(model, prompt, i):
    d, wall = post("http://127.0.0.1:1234/api/v0/completions", {
        "model": model, "prompt": "Run %d. %s" % (i, prompt), "max_tokens": GEN, "temperature": 0, "seed": 42, "stream": False})
    s = d.get("stats", {})
    u = d.get("usage", {})
    gen_time = s.get("generation_time")
    ttft = s.get("time_to_first_token")
    return {"prompt_tokens": u.get("prompt_tokens"), "prompt_tps": (u.get("prompt_tokens") / ttft) if ttft else None,
            "gen_tokens": u.get("completion_tokens"), "gen_tps": s.get("tokens_per_second"), "ttft_s": ttft,
            "gen_time_s": gen_time, "wall_s": wall, "runtime": d.get("runtime"), "model_info": d.get("model_info")}


def mlxlm(prompt, i):
    pf = os.path.join(W, ".prompt.txt")
    open(pf, "w").write("Run %d. %s" % (i, prompt))
    out = subprocess.run(["mlx_lm.generate", "--model", MLX_PATH, "--prompt", "-", "--max-tokens", str(GEN), "--temp", "0",
                          "--ignore-chat-template", "--seed", "42"], stdin=open(pf), env=ENV, capture_output=True, text=True)
    txt = out.stdout + out.stderr
    p = re.search(r"Prompt: (\d+) tokens, ([\d.]+) tokens-per-sec", txt)
    g = re.search(r"Generation: (\d+) tokens, ([\d.]+) tokens-per-sec", txt)
    m = re.search(r"Peak memory: ([\d.]+) GB", txt)
    return {"prompt_tokens": int(p.group(1)), "prompt_tps": float(p.group(2)), "gen_tokens": int(g.group(1)),
            "gen_tps": float(g.group(2)), "peak_gb": float(m.group(1))}


def run(label, fn, prompt_name, prompt):
    fn(prompt, 0)  # warm-up, discarded
    rows = []
    for i in range(1, RUNS + 1):
        la = load_snapshot()
        r = fn(prompt, i)
        r.update({"label": label, "prompt_set": prompt_name, "run": i, "loadavg": la, "ts": time.strftime("%Y-%m-%d %H:%M:%S")})
        rows.append(r)
        with open(OUT, "a") as f:
            f.write(json.dumps(r) + "\n")
        print(json.dumps(r), flush=True)
    for k in ("prompt_tps", "gen_tps"):
        vals = [x[k] for x in rows if x.get(k)]
        if vals:
            print("MEDIAN %s %s %s %.2f" % (label, prompt_name, k, statistics.median(vals)), flush=True)


if __name__ == "__main__":
    which = sys.argv[1]
    if which.startswith("ollama:"):
        model = which.split(":", 1)[1]
        f = lambda p, i: ollama(model, p, i)
    elif which.startswith("lms:"):
        model = which.split(":", 1)[1]
        f = lambda p, i: lmstudio(model, p, i)
    else:
        f = mlxlm
    run(which, f, "short", SHORT)
    run(which, f, "long", LONG)

Run one runtime at a time, and stop or unload the previous model between legs so only one holds your GPU memory. The legs below reproduce four of the six rows (the default Ollama tag, the Ollama GGUF tag, LM Studio MLX and mlx-lm), in the order we ran them. The GGUF tag needs its own pull first, because the Ollama API does not pull on demand:

python3 bench.py ollama:qwen3.5:9b
ollama stop qwen3.5:9b
ollama pull qwen3.5:9b-q4_K_M
python3 bench.py ollama:qwen3.5:9b-q4_K_M
ollama stop qwen3.5:9b-q4_K_M
lms load qwen/qwen3.5-9b --identifier qwen3.5-9b-mlx -c 4096 -y
python3 bench.py lms:qwen3.5-9b-mlx
lms unload --all
python3 bench.py mlx-lm

Each leg prints one JSON line per run and a MEDIAN line per metric, and appends everything to bench-results.jsonl. For the other two rows, ollama pull qwen3.5:9b-mlx covers the Ollama MLX tag, and the LM Studio GGUF row needs lms get qwen/qwen3.5-9b --gguf -y plus the folder move described under “How we tested”. Another base M4 with the same 120 GB/s memory bandwidth should land close to these figures. If your MLX generation rate comes out far above 21 tokens/s on this 6 GB file, check the runtime log for drafting before you credit the engine.

Where each runtime hits the 24 GB wall

All three allocate through Metal, so whichever you pick, you hit the same ceiling. The GPU on a 24 GB M4 may use 18,186 MiB by default, which is 74% of physical memory. MLX reports that figure as max_recommended_working_set_size, and iogpu.wired_limit_mb reads 0 while macOS applies it. The qwen3.5:27b-mlx tag takes 19 GB on disk according to ollama list (20 GB in ollama ps once loaded), and Ollama refused to load it:

ollama run qwen3.5:27b-mlx "Say ok."

Both numbers are in the refusal, so you can see how far over you are before touching anything.

Error: 500 Internal Server Error: model requires 18.4 GiB but only 17.3 GiB are available (after 512.0 MiB overhead)

The mlx-lm README gives the fix: set iogpu.wired_limit_mb above the model size and below total memory. We set 22,528 MB, which left about 2 GB for macOS:

sudo sysctl iogpu.wired_limit_mb=22528

MLX saw the new value at once (a fresh device_info() call returned 22,528 MB), but the running Ollama server kept refusing with the same 17.3 GiB message. It reads the limit when it starts, so you have to restart it. For the Homebrew service bootstrapped earlier, that’s a kickstart (on a desktop Mac where brew services worked, use brew services restart ollama instead):

launchctl kickstart -k user/$(id -u)/sh.brew.ollama

After the restart Ollama reported 21.5 GiB available and loaded the model. The capture tells the rest:

Ollama refusing qwen3.5:27b-mlx at the default Metal limit on a 24 GB M4, then loading it after sudo sysctl iogpu.wired_limit_mb=22528

The 27B model works, but only as a demo. The load took 201.5 seconds, generation ran at 5.71 tokens/s, the runner peaked at 18.73 GiB, memory_pressure reported 3% free and macOS had pushed 2,389 MiB into swap. That is roughly a quarter of the 9B speed for a model that leaves your Mac unusable for anything else. Put the limit back when you’re done:

sudo sysctl iogpu.wired_limit_mb=0
launchctl kickstart -k user/$(id -u)/sh.brew.ollama

With the Ollama app instead of the formula, quit it from the menu bar and open it again after each sysctl change. mlx-lm needs no restart, since every mlx_lm.generate call is a new process that reads the limit fresh.

Which one to pick, and which Mac to buy

On a 24 GB M4, plan on about 17.8 GiB for the GPU, keep models at 9B and 4-bit, and expect about 20 tokens/s without drafting and 27 with it. The measured peaks put a 9B model between 5.26 GB (mlx-lm, short prompt) and 10.83 GiB (Ollama 9b-mlx, long prompt), which should leave room for a longer context than the 4,096 tokens we ran (we did not test a 16k load). If you only pick one, match it to how you work.

  • You want a service other tools call: Ollama with the default tag. It’s the fastest Qwen3.5 result we measured, thanks to drafting.
  • You want a model browser and a chat window: LM Studio, at about 6% behind mlx-lm on the same file.
  • You’re short on memory or testing a new model: mlx-lm in a pinned Python, about 3 GB lighter than Ollama on the same prompt.

Speed on a dense model follows memory bandwidth. The M4 Pro and M4 Max announcement lists 120 GB/s for the M4, 273 GB/s for the M4 Pro and up to 546 GB/s for the M4 Max. Divide 120 GB/s by the 5.98 GB model folder and you get a rough bound near 20 tokens/s. mlx-lm measured 21.3, a little above it because not every byte in that folder (the embedding table, for one) is read for each token, but close enough to say the base chip is near its limit and no runtime switch will move it much further. If you want 27B to 35B models at usable speed, you need 48 GB or more on a Pro-class chip, where bandwidth roughly doubles.

Our Mac buying guide for local LLMs compares current Mac mini, Mac Studio and MacBook Pro configurations, and the Mac mini guide for AI agents covers the M6 against M5 Pro choice for an always-on box. If you haven’t settled on a Mac at all, the Mac mini vs mini PC vs GPU comparison puts these figures next to discrete GPUs, and the Ollama models cheat sheet by VRAM and the open-source LLM comparison table help you pick what to run on whichever box you end up with.

Keep reading

Ollama Models Cheat Sheet: Best Models by VRAM, Tested (PDF) AI Ollama Models Cheat Sheet: Best Models by VRAM, Tested (PDF) Open Source LLM Comparison Table (2026) AI Open Source LLM Comparison Table (2026) Claude Code Cheat Sheet: Commands, Shortcuts and Flags (PDF) AI Claude Code Cheat Sheet: Commands, Shortcuts and Flags (PDF) Dual GPU LLM Build: PCIe x8/x8 vs x16/x4, PSU and Cooling AI Dual GPU LLM Build: PCIe x8/x8 vs x16/x4, PSU and Cooling MCP vs RAG vs Agent Skills: When to Use Each AI MCP vs RAG vs Agent Skills: When to Use Each OpenCode CLI Cheat Sheet: Commands, Sessions and Fixes (PDF) AI OpenCode CLI Cheat Sheet: Commands, Sessions and Fixes (PDF)

Leave a Comment

Press ESC to close