ollama - ✅(Solved) Fix MLX models fail to load on macOS (Apple Silicon) in Ollama v0.20.4 — dynamic library not found [2 pull requests, 4 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#15433Fetched 2026-04-09 07:51:14
View on GitHub
Comments
4
Participants
4
Timeline
13
Reactions
2
Assignees
Timeline (top)
commented ×4referenced ×2assigned ×1closed ×1

Error Message

Error: 500 Internal Server Error: mlx runner failed: Error: MLX not available: failed to load MLX dynamic library (searched: [/opt/homebrew/Cellar/ollama/0.20.4/bin/lib/ollama /opt/homebrew/Cellar/ollama/0.20.4/bin /opt/homebrew/var/build/lib/ollama]) (exit: exit status 1)

Fix Action

Fix / Workaround

  1. Install Ollama v0.20.3 via Homebrew
  2. Run an MLX model (e.g., qwen3.5:35b-a3b-mlx-bf16) → works
  3. Upgrade to v0.20.4:

Workaround Rollback to v0.20.3 restores full functionality.

PR fix notes

PR #15443: mlx: remove stale x86 libmlx library

Description (problem / solution / changelog)

Fixes #15433

The release contains an extraneous library from the old pattern of placing it at the top.

% find app -name \*mlx\*.dylib | xargs file
app/Ollama.app/Contents/Resources/libmlx.dylib:               Mach-O 64-bit dynamically linked shared library x86_64
app/Ollama.app/Contents/Resources/mlx_metal_v3/libmlx.dylib:  Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
app/Ollama.app/Contents/Resources/mlx_metal_v3/libmlx.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
app/Ollama.app/Contents/Resources/mlx_metal_v3/libmlx.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64
app/Ollama.app/Contents/Resources/mlx_metal_v3/libmlxc.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
app/Ollama.app/Contents/Resources/mlx_metal_v3/libmlxc.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
app/Ollama.app/Contents/Resources/mlx_metal_v3/libmlxc.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64
app/Ollama.app/Contents/Resources/libmlxc.dylib:              Mach-O 64-bit dynamically linked shared library x86_64
app/Ollama.app/Contents/Resources/mlx_metal_v4/libmlx.dylib:  Mach-O 64-bit dynamically linked shared library arm64
app/Ollama.app/Contents/Resources/mlx_metal_v4/libmlxc.dylib: Mach-O 64-bit dynamically linked shared library arm64

The mlx_metal_v3 version is correctly lipo'd to support both architectures, so this top-level x86-only version was not supposed to be retained.

With this fix:

% find dist/Ollama.app -name \*mlx\*.dylib | xargs fi
le
dist/Ollama.app/Contents/Resources/mlx_metal_v3/libmlx.dylib:  Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
dist/Ollama.app/Contents/Resources/mlx_metal_v3/libmlx.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
dist/Ollama.app/Contents/Resources/mlx_metal_v3/libmlx.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64
dist/Ollama.app/Contents/Resources/mlx_metal_v3/libmlxc.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
dist/Ollama.app/Contents/Resources/mlx_metal_v3/libmlxc.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
dist/Ollama.app/Contents/Resources/mlx_metal_v3/libmlxc.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64
dist/Ollama.app/Contents/Resources/mlx_metal_v4/libmlx.dylib:  Mach-O 64-bit dynamically linked shared library arm64
dist/Ollama.app/Contents/Resources/mlx_metal_v4/libmlxc.dylib: Mach-O 64-bit dynamically linked shared library arm64

Changed files

  • scripts/build_darwin.sh (modified, +6/-1)

PR #30: Add image generation model and update provider to support it

Description (problem / solution / changelog)

<!-- Filling out this template is required. Any PR that does not include enough information to be reviewed may be closed at a maintainers' discretion. All new code requires documentation and tests to ensure against regressions. -->

Description of the Change

This PR adds support for Image generation model based on experimental feature of ollama please refer blog

This pull request adds support for image generation models to the Ollama provider integration. The most significant changes include the introduction of a new OllamaImageGenerationModel class, updates to model metadata detection to identify image generation capabilities, and enhancements to provider logic to instantiate the correct model type based on capabilities.

Image Generation Model Support:

  • Added a new OllamaImageGenerationModel class that implements image generation using the Ollama /api/generate endpoint, including prompt extraction, response parsing, and custom timeout handling.
  • Updated the provider logic in OllamaProvider to instantiate OllamaImageGenerationModel when a model supports image generation, based on its capabilities. [1] [2]

Model Metadata Detection:

  • Enhanced OllamaModelMetadataDirectory to detect image generation models by checking for the 'image' capability, and to construct appropriate ModelMetadata for such models with relevant options and output types. [1] [2] [3] [4]

Tooling and Static Analysis:

  • Updated phpstan.neon.dist to temporarily ignore the new OllamaImageGenerationModel.php file for static analysis, consistent with other files depending on unreleased WordPress core AI Client classes.

[!WARNING] Supported only on MacOS (because experiments are only avilable on MacOS) Tested with x/flux2-klein and x/z-image-turbo

Screenshots

  1. Verify the model is ready by visiting Settings->Ollama Settings

    <img width="1470" height="836" alt="Screenshot 2026-03-24 at 4 16 23 PM" src="https://github.com/user-attachments/assets/5a680349-01e8-4ab9-ba35-cc9dfe19a955" />
  2. Visit Media->Generate Image, Enter prompt

    <img width="1470" height="836" alt="Screenshot 2026-03-24 at 4 17 19 PM" src="https://github.com/user-attachments/assets/2d742da5-5849-4e90-a06f-15f7a06b85d0" />
  3. Generate Image

    <img width="1470" height="836" alt="Screenshot 2026-03-24 at 4 21 28 PM" src="https://github.com/user-attachments/assets/83afb232-db71-4b08-9c41-4ecaa297d99e" />
  4. Image in Media Gallery After saving it.

    <img width="1470" height="836" alt="Screenshot 2026-03-24 at 4 25 41 PM" src="https://github.com/user-attachments/assets/42f580f9-01ea-4a4a-8219-193239b47cee" />
<!-- Enter any applicable Issue number(s) here that will be closed/resolved by this PR. -->

Closes #

How to test the Change

Download Model

ollama pull x/flux2-klein

Test Model

ollama run x/flux2-klein "a cat holding a sign that says hello world"

Test Curl

curl http://localhost:11434/api/generate -d '{
  "model": "x/flux2-klein",
  "prompt": "a cat holding a sign that says hello world",
  "stream": false
}'

Now you can try generate Image in WordPress

Changelog Entry

<!-- Please include a summary for this PR, noting whether this is something being Added / Changed / Deprecated / Removed / Fixed / or Security related. You can replace the sample entries after this comment block with the single changelog entry line for this PR. -->

Added - support Image generation model

Credits

<!-- Please list any and all contributors on this PR so that they can be added to this projects CREDITS.md file. -->

Props @milindmore22

Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you are unsure about any of these, please ask for clarification. We are here to help! --> <!-- wp-playground-preview:start --> <a href="https://playground.wordpress.net?blueprint-url=data:application/json,%7B%22steps%22%3A%5B%7B%22step%22%3A%22installPlugin%22%2C%22pluginZipFile%22%3A%7B%22resource%22%3A%22url%22%2C%22url%22%3A%22https%3A%2F%2Fgithub.com%2FFueled%2Fai-provider-for-ollama%2Freleases%2Fdownload%2Fci-artifacts%2Fpr-30-5c8986c681c430420ce4dc4c11b1841212627c3e.zip%22%7D%7D%5D%7D" target="_blank" rel="noopener noreferrer"> <img src="https://raw.githubusercontent.com/adamziel/playground-preview/refs/heads/trunk/assets/playground-preview-button.svg" alt="Open WordPress Playground Preview" width="220" height="57" /> </a> <!-- wp-playground-preview:end -->

Changed files

  • includes/Metadata/OllamaModelMetadataDirectory.php (modified, +44/-3)
  • includes/Models/OllamaImageGenerationModel.php (added, +217/-0)
  • includes/Provider/OllamaProvider.php (modified, +8/-0)
  • phpstan.neon.dist (modified, +1/-0)
  • tests/Integration/Metadata/OllamaModelMetadataDirectoryTest.php (modified, +103/-0)
  • tests/Integration/Models/OllamaImageGenerationModelTest.php (added, +332/-0)
  • tests/Integration/Provider/OllamaProviderTest.php (modified, +85/-1)

Code Example

brew upgrade ollama

---

ollama run qwen3.5:35b-a3b-mlx-bf16 "Reply with exactly: OK"

---

OK

---

Error: 500 Internal Server Error: mlx runner failed:
Error: MLX not available: failed to load MLX dynamic library
(searched: [/opt/homebrew/Cellar/ollama/0.20.4/bin/lib/ollama
/opt/homebrew/Cellar/ollama/0.20.4/bin
/opt/homebrew/var/build/lib/ollama])
(exit: exit status 1)

---

ollama run llama3.3:70b "Reply with exactly: OK"

---
RAW_BUFFERClick to expand / collapse

What is the issue?

Title: MLX models fail to load on macOS (Apple Silicon) in Ollama v0.20.4 — dynamic library not found

Environment

  • Host: Apple Silicon (M4 Max)
  • OS: macOS (latest, Apple Silicon)
  • Ollama version: 0.20.4 (Homebrew)
  • Previous working version: 0.20.3
  • Installation method: Homebrew upgrade (brew upgrade ollama)
  • Launch method: launchctl (custom LaunchAgent)

Summary After upgrading from Ollama v0.20.3 to v0.20.4, MLX-based models fail to run with a dynamic library load error. Non-MLX models (e.g., Llama 3.3) continue to function normally.

This appears to be a regression specific to MLX runner initialization or packaging in 0.20.4.


Steps to Reproduce

  1. Install Ollama v0.20.3 via Homebrew

  2. Run an MLX model (e.g., qwen3.5:35b-a3b-mlx-bf16) → works

  3. Upgrade to v0.20.4:

    brew upgrade ollama
  4. Restart Ollama service

  5. Run:

    ollama run qwen3.5:35b-a3b-mlx-bf16 "Reply with exactly: OK"

Expected Behavior Model runs normally and returns:

OK

Actual Behavior Fails with:

Error: 500 Internal Server Error: mlx runner failed:
Error: MLX not available: failed to load MLX dynamic library
(searched: [/opt/homebrew/Cellar/ollama/0.20.4/bin/lib/ollama
/opt/homebrew/Cellar/ollama/0.20.4/bin
/opt/homebrew/var/build/lib/ollama])
(exit: exit status 1)

Additional Observations

  • Restarting Ollama does not resolve the issue

  • MLX failure is consistent and reproducible

  • Non-MLX models work correctly:

    ollama run llama3.3:70b "Reply with exactly: OK"

    → returns OK

  • Rolling back to v0.20.3 fully restores MLX functionality

  • Homebrew uninstall of 0.20.4 removed mlx and mlx-c, which may be related


Impact

  • All MLX-based models unusable on macOS Apple Silicon
  • Breaks Qwen MLX workflows entirely
  • Forces rollback to 0.20.3

Notes This appears to be either:

  • a packaging issue (missing MLX dynamic libraries), or
  • a runtime path resolution issue for MLX components in 0.20.4

Workaround Rollback to v0.20.3 restores full functionality.


Request Please confirm:

  • whether MLX packaging changed in 0.20.4
  • whether additional dependencies are now required
  • or if this is an unintended regression

Thanks for your work on Ollama—performance on Apple Silicon has been excellent, especially with MLX models.


Reproducibility: 100% Severity: High (breaks MLX inference entirely)

Relevant log output

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

extent analysis

TL;DR

The most likely fix is to rollback to Ollama version 0.20.3, as it has been confirmed to restore MLX functionality.

Guidance

  • Verify that the issue is specific to MLX models by running non-MLX models (e.g., Llama 3.3) to confirm they work correctly.
  • Check the installation and packaging of MLX dynamic libraries in Ollama version 0.20.4 to identify any potential issues.
  • Investigate the runtime path resolution for MLX components in 0.20.4 to ensure that the dynamic libraries are being loaded correctly.
  • Consider reinstalling Ollama version 0.20.4 using Homebrew to ensure that all dependencies are properly installed.

Example

No code snippet is provided as the issue appears to be related to packaging or dependency issues rather than code-specific problems.

Notes

The issue seems to be specific to Ollama version 0.20.4 and Apple Silicon (M4 Max) on macOS. Rolling back to version 0.20.3 has been confirmed to resolve the issue, but it is unclear whether this is due to a packaging issue or a runtime path resolution problem.

Recommendation

Apply the workaround by rolling back to Ollama version 0.20.3, as it has been confirmed to restore MLX functionality and there is no clear indication of additional dependencies or changes in MLX packaging in version 0.20.4.

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