ollama - 💡(How to fix) Fix [Bug]: Metal compilation error on Apple M5 (macOS Tahoe 26.3.1) - static_assert failed [3 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15594Fetched 2026-04-16 06:35:55
View on GitHub
Comments
3
Participants
4
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×3labeled ×1

Models fail to load on the new Apple M5 hardware running macOS Tahoe 26.3.1. The llama runner terminates with exit status 2 due to a critical compilation error in the embedded Metal library.

It seems the Metal compiler in this hardware/OS combination has stricter requirements for cooperative tensor types, causing a mismatch between bfloat and half types that prevents the engine from starting.

Error Message

The following error is captured in ~/.ollama/logs/server.log during the model load attempt:

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"

The runner crashes shortly after:

time=2026-04-14T14:42:25.972-03:00 level=ERROR source=server.go:316 msg="llama runner terminated" error="exit status 2"
[GIN] 2026/04/14 - 14:42:25 | 500 |  2.125581542s |       127.0.0.1 | POST     "/api/generate"

Root Cause

Models fail to load on the new Apple M5 hardware running macOS Tahoe 26.3.1. The llama runner terminates with exit status 2 due to a critical compilation error in the embedded Metal library.

It seems the Metal compiler in this hardware/OS combination has stricter requirements for cooperative tensor types, causing a mismatch between bfloat and half types that prevents the engine from starting.

Code Example

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"

---

time=2026-04-14T14:42:25.972-03:00 level=ERROR source=server.go:316 msg="llama runner terminated" error="exit status 2"
[GIN] 2026/04/14 - 14:42:25 | 500 |  2.125581542s |       127.0.0.1 | POST     "/api/generate"

---

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"
RAW_BUFFERClick to expand / collapse

What is the issue?

Description

Models fail to load on the new Apple M5 hardware running macOS Tahoe 26.3.1. The llama runner terminates with exit status 2 due to a critical compilation error in the embedded Metal library.

It seems the Metal compiler in this hardware/OS combination has stricter requirements for cooperative tensor types, causing a mismatch between bfloat and half types that prevents the engine from starting.

Logs

The following error is captured in ~/.ollama/logs/server.log during the model load attempt:

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"

The runner crashes shortly after:

time=2026-04-14T14:42:25.972-03:00 level=ERROR source=server.go:316 msg="llama runner terminated" error="exit status 2"
[GIN] 2026/04/14 - 14:42:25 | 500 |  2.125581542s |       127.0.0.1 | POST     "/api/generate"

Environment

  • Ollama version: 0.20.7
  • OS: macOS Tahoe 26.3.1
  • Hardware: Apple M5 (16GB Unified Memory)
  • Models tested: qwen3.5:2b, qwen3.5:0.8b, llama3.2:1b

Steps to Reproduce

  1. Install Ollama on an Apple M5 Mac running macOS Tahoe.
  2. Attempt to run any model: ollama run qwen3.5:2b.
  3. The model fails to load with Error: 500 Internal Server Error.

Additional Context

Attempting to bypass the GPU with export OLLAMA_LLM_LIBRARY=cpu does not prevent the runner from attempting to initialize the Metal library, which still leads to the same crash. This suggests the initialization sequence for Metal in the current runner is incompatible with the M5's GPU family (MTLGPUFamilyApple10).

Relevant log output

ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
In file included from /System/Library/Frameworks/MetalPerformancePrimitives.framework/Headers/__impl/MPPTensorOpsMatMul2dImpl.h:3266:5: 
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' 
"Input types must match cooperative tensor types"

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.20.7

extent analysis

TL;DR

The issue can be resolved by updating the Ollama version to support the stricter Metal compiler requirements on Apple M5 hardware with macOS Tahoe.

Guidance

  • Verify that the error is caused by the Metal library initialization by checking the server.log for the ggml_metal_library_init error message.
  • Attempt to bypass the GPU with export OLLAMA_LLM_LIBRARY=cpu to confirm that the issue is related to the Metal library.
  • Consider updating the Ollama version to a newer release that may include fixes for the Metal compiler compatibility issues on Apple M5 hardware.
  • If updating Ollama is not possible, try to find alternative models that are compatible with the current Metal library version.

Example

No code snippet is provided as the issue is related to a compatibility problem between the Ollama version and the Metal library on Apple M5 hardware.

Notes

The current Ollama version (0.20.7) may not be compatible with the stricter Metal compiler requirements on Apple M5 hardware with macOS Tahoe. Updating to a newer version of Ollama may resolve the issue.

Recommendation

Apply workaround: Update Ollama to a version that supports the stricter Metal compiler requirements on Apple M5 hardware with macOS Tahoe, if available. This is recommended because the current version (0.20.7) is incompatible with the Metal library on this specific hardware and OS combination.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING