[GH-ISSUE #15748] Ollama 0.21.0 fails to initialize Metal on Apple M5 / macOS 26.2 while 0.18.0 works #87726

Open
opened 2026-05-10 06:17:13 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @huebner21 on GitHub (Apr 22, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15748

Summary

ollama 0.21.0 fails to load local models on Apple M5 with macOS 26.2 because Metal initialization crashes during embedded Metal library compilation. Rolling back to 0.18.0 fixes the issue immediately on the same machine with the same models.

Environment

  • Ollama 0.21.0
  • macOS 26.2
  • Darwin 25.2.0
  • Apple M5
  • Mac17,2

Regression

This machine works again after downgrading to Ollama 0.18.0.

  • 0.21.0: local model load fails
  • 0.18.0: ollama run llama3.2:latest ... succeeds and loads on GPU

Repro

ollama run "llama3.2:latest" "Return exactly this JSON and nothing else: {\"ok\":true}" --format json --nowordwrap

Actual result on 0.21.0

Model load fails with Metal initialization errors.

From ~/.ollama/logs/server.log:

ggml_metal_init: the device does not have a precompiled Metal library - this is unexpected
ggml_metal_library_init: using embedded metal library
... MPPTensorOpsMatMul2dImpl.h ...
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' "Input types must match cooperative tensor types"
error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<half, bfloat>' "Input types must match cooperative tensor types"
ggml_metal_init: error: failed to initialize the Metal library
ggml_backend_metal_device_init: error: failed to allocate context
llama_init_from_model: failed to initialize the context: failed to initialize Metal backend
panic: unable to create llama context

Expected result

The model should load and run locally, as it does on 0.18.0 on the same machine.

Additional notes

  • This is not model-specific; it reproduced on at least llama3.2:latest
  • It is not fixed by trying OLLAMA_LLM_LIBRARY=cpu; Metal initialization still occurs in 0.21.0
  • The issue appears specific to the newer runtime on Apple M5 / current Metal toolchain
Originally created by @huebner21 on GitHub (Apr 22, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15748 ### Summary `ollama` 0.21.0 fails to load local models on Apple M5 with macOS 26.2 because Metal initialization crashes during embedded Metal library compilation. Rolling back to 0.18.0 fixes the issue immediately on the same machine with the same models. ### Environment - Ollama 0.21.0 - macOS 26.2 - Darwin 25.2.0 - Apple M5 - Mac17,2 ### Regression This machine works again after downgrading to Ollama 0.18.0. - 0.21.0: local model load fails - 0.18.0: `ollama run llama3.2:latest ...` succeeds and loads on GPU ### Repro ```bash ollama run "llama3.2:latest" "Return exactly this JSON and nothing else: {\"ok\":true}" --format json --nowordwrap ``` ### Actual result on 0.21.0 Model load fails with Metal initialization errors. From `~/.ollama/logs/server.log`: ```text ggml_metal_init: the device does not have a precompiled Metal library - this is unexpected ggml_metal_library_init: using embedded metal library ... MPPTensorOpsMatMul2dImpl.h ... error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>' "Input types must match cooperative tensor types" error: static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<half, bfloat>' "Input types must match cooperative tensor types" ggml_metal_init: error: failed to initialize the Metal library ggml_backend_metal_device_init: error: failed to allocate context llama_init_from_model: failed to initialize the context: failed to initialize Metal backend panic: unable to create llama context ``` ### Expected result The model should load and run locally, as it does on 0.18.0 on the same machine. ### Additional notes - This is not model-specific; it reproduced on at least `llama3.2:latest` - It is not fixed by trying `OLLAMA_LLM_LIBRARY=cpu`; Metal initialization still occurs in 0.21.0 - The issue appears specific to the newer runtime on Apple M5 / current Metal toolchain
Author
Owner

@Slaaavo commented on GitHub (Apr 23, 2026):

ersion 0.20.3 (0.20.3) works too. I don't understand why this hasn't been fixed yet

<!-- gh-comment-id:4303158072 --> @Slaaavo commented on GitHub (Apr 23, 2026): ersion 0.20.3 (0.20.3) works too. I don't understand why this hasn't been fixed yet
Author
Owner

@ShankaraDash commented on GitHub (Apr 27, 2026):

Upgrading to macOS 26.4.1 from 26.3 solved the problem on my brand new M5 machine.

<!-- gh-comment-id:4329003949 --> @ShankaraDash commented on GitHub (Apr 27, 2026): Upgrading to macOS 26.4.1 from 26.3 solved the problem on my brand new M5 machine.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#87726