Skip to content
Black FridayBlack Friday: both apps $5.99, ends 1 Dec

Guide

How much memory does Ollama use on a Mac?

An Ollama model holds about its download size in memory, plus a context cache, for as long as it stays loaded. Here's how to see the real figure on your Mac, why it's often bigger than the download, and how to give the memory back.

By · Updated · 8 min read

The short answer

Run ollama ps. The SIZE column is the memory each loaded model holds right now: its weights, roughly the download size, plus the context cache and working buffers. CONTEXT shows the context length it was loaded with. In current Ollama (0.15.5 and later), the default context depends on how much GPU memory Ollama finds (4K, 32K or 256K tokens, never more than the model supports), so the same model can hold much more memory on a Mac with more RAM. PROCESSOR should read 100% GPU; a CPU/GPU split means part of it didn't fit. UNTIL says when Ollama unloads it, 5 minutes after the last request by default. To give the memory back now, run ollama stop with the model's name.

On this page

Check what's loaded with ollama ps

Ollama loads a model the first time you send it a request and keeps it in memory for a while afterwards, so the next request starts instantly. ollama ps lists what's loaded now:

Models Ollama has loaded
ollama ps
Example output (illustrative: the column layout from Ollama's docs, figures not measured; 0.40.0 and later add a RUNNER column)
NAME                 ID              SIZE     PROCESSOR    CONTEXT    UNTIL
qwen2.5-coder:14b    9ec8897f747e    10 GB    100% GPU     8192       4 minutes from now
  • SIZE

    Meaning
    Memory the loaded model holds: weights, context cache and working buffers.
  • PROCESSOR

    Meaning
    Where the model was loaded. Ollama's FAQ: 100% GPU means entirely on the GPU, 100% CPU entirely in system memory, and a split such as 48%/52% CPU/GPU means partly on both. A split runs much slower.
  • CONTEXT

    Meaning
    The context length, in tokens, it was loaded with (Ollama 0.10.0 and later). A longer context needs more memory.
  • RUNNER

    Meaning
    The runner the model was loaded with, such as llamacpp, ggml or mlx (Ollama 0.40.0 and later).
  • UNTIL

    Meaning
    When Ollama will unload it if nothing else asks for it.
What the columns mean

The same figures come from Ollama's local API, which is what other tools read:

Loaded models as JSON (size and size_vram in bytes, context_length in tokens)
curl -s http://localhost:11434/api/ps

Why it holds more than the download size

A model in memory is three things added together:

  1. The weights. About the download size. Quantisation decides it: Q4_K_M stores roughly 0.6 GB per billion parameters, Q8_0 about 1.1 GB, and full 16-bit weights 2 GB.
  2. The context cache. Memory for every token of context the model can see, reserved for the context length it was loaded with. Llama 3.1 8B has 32 layers and 8 key-value heads of 128 values, so at 16-bit precision its cache takes 128 KiB per token: 1 GiB at 8K tokens, 4 GiB at 32K and 16 GiB at 128K. Other models differ with their shape.
  3. Working buffers for the computation itself.
  • llama3.1:8b

    Parameters
    8B
    Download
    4.9 GB
  • qwen2.5-coder:14b

    Parameters
    14.8B
    Download
    9.0 GB
  • qwen2.5:32b

    Parameters
    32.8B
    Download
    20 GB
  • llama3.3:70b

    Parameters
    70.6B
    Download
    43 GB
Download sizes of Ollama's default tags, all Q4_K_M, as listed on ollama.com. Add the context cache on top

The context length Ollama picks for your Mac

Ollama's context-length documentation says that, unless you set one, the default context length depends on the GPU memory available; the server code has done this since 0.15.5. On a Mac, that's the memory Metal reports for the GPU, a share of unified memory rather than all of it (below). Ollama's FAQ still gives 4,096 tokens as the default, which is now only the lowest tier.

  • Under 24 GiB

    Default context
    4K tokens
  • 24–48 GiB

    Default context
    32K tokens
  • 48 GiB or more

    Default context
    256K tokens
Ollama's default context length by GPU memory, from its documentation (Ollama 0.15.5 and later, checked at 0.40.1)

So a Mac with plenty of memory loads models with a much longer context by default, and ollama ps shows a larger SIZE for the same model. The default is never more than the context the model was trained for, and when Ollama chose it automatically and it doesn't fit, Ollama steps it down to 32K, then 4K. A context set in the model's Modelfile, or by you, takes priority. To choose it yourself, set OLLAMA_CONTEXT_LENGTH in the environment the server runs in, num_ctx in a request's options, or /set parameter num_ctx in an interactive session.

The default context Ollama picked on this Mac, from its server log
grep "vram-based default context" ~/.ollama/logs/server.log | tail -1
  • Flash attention reduces memory use as the context grows. Ollama's FAQ says it's used automatically when the backend and devices support it. In 0.40.1, for models run through llama.cpp on Apple silicon, Ollama leaves the choice on automatic and llama.cpp uses it where the model supports it; other runners may behave differently. OLLAMA_FLASH_ATTENTION=1 forces it on and 0 turns it off.
  • A quantised cache saves more: Ollama's FAQ says OLLAMA_KV_CACHE_TYPE=q8_0 uses about half the memory of the default f16 with a very small loss in precision, and q4_0 about a quarter, with a loss that may be more noticeable at long contexts. It only works with flash attention enabled, and it applies to every model the server loads.
  • Parallel requests multiply the cache. Ollama's FAQ says required memory scales with OLLAMA_NUM_PARALLEL times the context length.

The GPU's share of memory

An Apple silicon Mac has one pool of unified memory shared by the CPU and GPU. macOS lets the GPU use a large share of it, but not all: Metal reports a recommended working-set size for each Mac, which Apple describes as roughly how much memory the GPU can allocate without affecting its performance. In one of Apple's Metal talks, an M1 Pro or M1 Max with 32 GB can give the GPU 21 GB, and one with 64 GB can give it 48 GB. A model that fits under the limit runs fully on the GPU. One that doesn't is split, and Ollama runs the rest on the CPU, much more slowly.

So on a 16 GB Mac, a 14B model at Q4_K_M is near the limit before any other app has asked for memory. The will this model fit guide shows how to work it out for your Mac.

How to give the memory back

Unload one model now
ollama stop qwen2.5-coder:14b

To change how long models stay loaded, set the keep-alive. Per request, keep_alive accepts a duration such as "10m", a number of seconds, 0 to unload straight after answering, or a negative number to keep the model loaded. For every model, set OLLAMA_KEEP_ALIVE in the environment Ollama's server runs in; a request's keep_alive overrides it.

Unload through the API (what keep-alive 0 does)
curl http://localhost:11434/api/generate -d '{"model": "qwen2.5-coder:14b", "keep_alive": 0}'

To use less memory while it's loaded, pick a smaller quantisation (Q4 instead of Q8), a shorter context, or a quantised context cache as above.

When a model makes the whole Mac slow

  • Memory pressure turns yellow or red when a model loads on top of a browser, Docker and an IDE. macOS compresses memory and swaps, and everything slows down. Unload the model, or quit something large first.
  • The PROCESSOR column shows a CPU/GPU split. The model is bigger than the GPU's share of memory. A smaller model, quantisation or context fixes it; a faster CPU doesn't.
  • Several models are loaded at once. By default Ollama can keep up to 3 models loaded (OLLAMA_MAX_LOADED_MODELS), and each holds its own memory. ollama ps lists them all.
  • The default context is larger than you need. On a Mac with a lot of memory, the 256K default tier can hold many gigabytes for a model trained for long contexts. Set OLLAMA_CONTEXT_LENGTH to what your work uses.

The faster way: AI models in iKnowMyMac

iKnowMyMac's AI models section, under Projects, asks Ollama, LM Studio, llama.cpp's server and MLX servers on 127.0.0.1 which models are loaded, and shows the memory each one holds against the GPU memory limit macOS sets for your Mac, with when Ollama will unload it. Nothing leaves your Mac, and prompts are never read.

The AI models section in iKnowMyMac: three models loaded in Ollama, llama.cpp and LM Studio hold 21.4 GB of this Mac's 27 GB GPU memory limit, each with its quantisation, context, memory, GPU load and status, above the models on disk.
AI models in iKnowMyMac, rendered from the app with simulated models and figures.

FAQ

Questions

Something else? support@iknowmymac.com

How much RAM do I need to run Ollama on a Mac?

Enough for the model plus everything else you have open. As a rough estimate, a model needs about its download size plus its context cache, about 1 GiB per 8K tokens for an 8B model, and it should stay under the GPU's share of memory. On a 16 GB Mac, 7–8B models at Q4_K_M leave room for other apps; 14B models are tight. Check ollama ps and memory pressure on your own Mac to be sure.

Does Ollama keep using memory after I close the chat?

For a while. A model stays loaded for 5 minutes after the last request by default, then Ollama unloads it. ollama ps shows when, and ollama stop with the model's name unloads it straight away.

Why does ollama ps show more than the model's download size?

The figure includes the context cache, which is reserved for the whole context length when the model loads, plus working buffers. Recent Ollama versions pick a longer default context on Macs with more GPU memory, which makes the number bigger. The CONTEXT column shows the length it used.

Is ollama ps the same as the memory in Activity Monitor?

No. Ollama runs models in a separate runner process, and GPU memory is counted differently from ordinary app memory, so Activity Monitor's Memory column usually doesn't match. Ollama's own figure is the one to go by for the model.

Know why your Mac is slow.

macOS 15 Sequoia or later · Apple silicon. A 55.3 MB native app, notarized by Apple. No account, no analytics, no telemetry.

One-time purchase · every feature · 5-day refund