Grux AI Download

How do I change Ollama's context length on a Mac?

In the Ollama app on a Mac, open its settings and move the context length slider; from a terminal, start the server with OLLAMA_CONTEXT_LENGTH=64000 ollama serve. Then run ollama ps, whose CONTEXT column shows what each loaded model actually got. Do not trust a remembered default: Ollama's own pages give two, 4096 tokens in its FAQ and 4k, 32k or 256k by VRAM on its context page, and the Hermes Agent guide quotes a third, 2048. Ollama says tasks that need a large context, such as web search, agents and coding tools, should be set to at least 64000 tokens, and that a larger context length needs more memory, so read the PROCESSOR column of ollama ps too. This page repeats Ollama's documents and measured nothing on a Mac.

Download Grux AI 3.3.1, free, for macOS 14 or later on Apple silicon.

Grux AI 3.3.1 · sources read 2026-11-19 · published 2026-11-19

Three documents, three defaults

DocumentWhat it says about the default
Ollama, Context lengthDefaults by VRAM: under 24 GiB, 4k; 24 to 48 GiB, 32k; 48 GiB or more, 256k.
Ollama, Local FAQBy default, Ollama uses a context window size of 4096 tokens.
Hermes Agent, guide to running it with OllamaBy default, Ollama uses a 2048-token context.

The context page is written in VRAM and does not say how it counts a Mac's unified memory. Which default your Mac gets is therefore not something this page can tell you; the check below shows it.

Set it

OLLAMA_CONTEXT_LENGTH=64000 ollama serve
launchctl setenv OLLAMA_CONTEXT_LENGTH 64000
curl http://localhost:11434/api/generate -d '{
  "model": "llama3.2",
  "prompt": "Why is the sky blue?",
  "options": {
    "num_ctx": 4096
  }
}'

Check what a model got

Ollama's context page says to verify the split under PROCESSOR with ollama ps, and its example output adds a CONTEXT column:

NAME             ID              SIZE      PROCESSOR    CONTEXT    UNTIL
gemma4:latest    c6eb396dbd59    9.6 GB    100% GPU     131072     2 minutes from now

The page's advice is to use the maximum context length for a model and avoid offloading the model to the CPU. Is Ollama using my Mac's GPU? explains the PROCESSOR column.

A longer context costs memory

Flash Attention and the K/V cache

The FAQ says Flash Attention can significantly reduce memory use as the context grows, that Ollama uses it automatically when the backend and devices support it, and that OLLAMA_FLASH_ATTENTION=1 forces it on and =0 turns it off. It does not say which Macs support it, so this page cannot say whether yours does. It also says the K/V cache can be quantized to reduce memory when Flash Attention is enabled, with OLLAMA_KV_CACHE_TYPE, a global setting for all models:

OLLAMA_KV_CACHE_TYPEWhat the FAQ says
f16High precision and memory use; the default.
q8_08-bit; approximately 1/2 the memory of f16 with a very small loss in precision, usually no noticeable impact on quality; recommended if you are not using f16.
q4_04-bit; approximately 1/4 the memory of f16 with a small to medium loss in precision that may be more noticeable at higher context sizes.

The FAQ adds that the effect on quality depends on the model and the task, and that models with a high GQA count, Qwen2 for example, may see a larger effect. Homebrew's Ollama service sets q8_0 and Flash Attention for you: see brew install ollama on a Mac.

What agents ask for

Ollama's context page says tasks that need a large context, such as web search, agents and coding tools, should be set to at least 64000 tokens. Hermes Agent's guides ask for the same minimum: Hermes Agent on a Mac. For coding agents see Coding agent with a local model on a Mac.

What this page does not say

Where to check this

ClaimSource
The defaults by VRAM, the slider, OLLAMA_CONTEXT_LENGTH, ollama ps with a CONTEXT column, at least 64000 tokens, more memory, cloud models at their maximumOllama docs, Context length
4096 tokens, /set parameter num_ctx, the API num_ctx, launchctl setenv, parallel requests, Flash Attention, the K/V cache typesOllama docs, Local FAQ
2048 tokens, and 64,000 tokens requiredHermes Agent guide: Run Hermes Locally with Ollama
The service sets Flash Attention and q8_0Homebrew, formula ollama

Questions

What is Ollama's default context length?
Ollama's documents disagree. Its FAQ says 4096 tokens; its context page says 4k under 24 GiB of VRAM, 32k from 24 to 48 GiB and 256k from 48 GiB; the Hermes Agent guide says 2048. Run ollama ps to read what a model got.
How do I set Ollama's context length on a Mac?
Move the context length slider in the Ollama app's settings, or start the server with OLLAMA_CONTEXT_LENGTH set, for example OLLAMA_CONTEXT_LENGTH=64000 ollama serve.
How do I see the context length a model is using?
Run ollama ps: Ollama's context page shows a CONTEXT column beside PROCESSOR, which says whether the model runs on the GPU, the CPU or both.
Why does a longer context use more memory?
Ollama says a larger context length increases the memory a model needs. Its FAQ says Flash Attention can reduce memory use as the context grows and that a q8_0 K/V cache uses approximately 1/2 the memory of the default f16.
Download Grux AI 3.3.1 Read the source

Free, MIT licensed. macOS 14 or later, Apple silicon. 29.1 MB, signed and notarized by Apple. No account, no server, no subscription.