Metal / Apple Silicon

Metal allocation failed — Apple Silicon OOM under unified memory pressure

metal::MetalCommandQueue allocation failed or [MPS] OOM
By Eruo Fredoline · Last verified Oct 7, 2026

Cause

Apple Silicon shares one memory pool between CPU + GPU + Neural Engine. Under pressure (large model + browser + system), the GPU allocator fails even though some RAM is free elsewhere. Causes:

  • Model size + KV cache exceed practical Mac VRAM ceiling (~70% of physical RAM)
  • macOS swapping to disk under pressure (kills throughput)
  • Other processes (Chrome, Xcode indexing, Time Machine) eating unified memory
  • MLX or llama.cpp Metal not setting GPU memory limit explicitly

Solution

1. Check pressure with vm_stat or Activity Monitor's Memory Pressure graph. If you're in yellow/red, free RAM first.

2. Drop the model size or quant:

# 70B Q4 needs ~45 GB unified memory; not viable on 32 GB Macs
# Drop to 32B Q4 (~20 GB) or 14B Q4 (~9 GB)

3. Close memory-heavy apps. Chrome easily eats 4-8 GB. Xcode indexing 2-4 GB. Time Machine + Spotlight indexing 1-2 GB. Disable Spotlight indexing on /Volumes/ if relevant.

4. Set GPU memory limit explicitly in MLX:

import mlx.core as mx
mx.metal.set_memory_limit(0.85)  # 85% of physical RAM ceiling

5. Use caffeinate for long jobs so macOS doesn't sleep mid-inference:

caffeinate -i mlx_lm.generate --model ... --prompt ...

6. Bigger picture: Apple Silicon is bandwidth-bound. For sustained workloads, Mac Studio M3 Ultra 192GB or M4 Ultra 256GB is the production-grade target. See Mac Studio M3 Ultra combo.

Cloud GPU rental

Model too big for your Mac's memory? Rent a GPU by the hour

If the model does not fit in your Mac's unified memory even with a smaller quant and a shorter context, you can rent a GPU with more memory by the hour. Rented GPUs run CUDA or ROCm, not Metal or MLX, so you would run the model there with llama.cpp, Ollama or vLLM.

RunPod

billed per GPU-hour

Hourly GPU pods, in community-cloud and secure-cloud tiers.

The two tiers run on different hosts and terms. Check which tier a pod is on before a long job.

Rent on RunPod

Vast.ai

billed per GPU-hour

Marketplace of host-listed GPUs; price and reliability vary by host.

Host quality varies. Filter for verified hosts and check the host's reliability before a long run.

Rent on Vast.ai

Referral links: RunLocalAI may earn a commission or account credits if you sign up and rent, at no extra cost to you. Hourly rates and which GPUs are listed change all the time, so check the provider's page before you start. Editorial opinions are independent of the referral relationship; see how we make money.

Related errors

Did this fix it?

If your case was different, email Contact support with what you saw and we'll update the page. If it worked but took different commands on your platform, we want to know that too.