Can't disable CMAKE ARG on Apple: GGML_METAL=OFF

Open Beginner friendly
#2,050 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
c, cmake, cpp, python
Domain
build-system

Research direction

The issue points to line 95 in the main CMakeLists.txt file. Examine that line and the surrounding logic to understand how GGML_METAL is forced on Apple platforms. The goal is to modify the CMake logic to allow a user-provided GGML_METAL=OFF flag to be respected, while preserving the default behavior. Test the change by building with the provided CMAKE_ARGS to ensure Vulkan works and Metal is disabled.

Written by the indexing model from the issue text.

Description

Expected Behavior

I can disable GGML_METAL and enable GGML_VULKAN.

Current Behavior

Due to this line in the CMAKE config I cannot set GGML_METAL=OFF as it is forced.

Environment and Context

I'm trying to build GGML_VULKAN=ON with Metal off as I want to use MoltenVK on my Intel MBP with an AMD GPU. I have already successfully don't this directly with llama.cpp.

I am having to resort to cloning the repo and patching the lines by hand, which is not ideal.

  • Physical (or virtual) hardware you are using, e.g. for Linux:

2019 Intel MBP

  • Operating System, e.g. for Linux:

MacOS 15.5

  • SDK version, e.g. for Linux:
Python 3.11.9

GNU Make 3.81

Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: x86_64-apple-darwin24.5.0
Thread model: posix

Steps to Reproduce

CMAKE_ARGS="-DGGML_METAL=OFF -DGGML_VULKAN=ON \
-DVulkan_INCLUDE_DIR=/Users/brenden/VulkanSDK/1.4.309.0/macOS/include \
-DVulkan_LIBRARY=/Users/brenden/VulkanSDK/1.4.309.0/macOS/lib/libMoltenVK.dylib \
-DOpenMP_ROOT=$(brew --prefix)/opt/libomp \
-DVulkan_GLSLC_EXECUTABLE=$(brew --prefix)/opt/shaderc/bin/glslc \
-DVulkan_GLSLANG_VALIDATOR_EXECUTABLE=$(brew --prefix)/opt/glslang/bin/glslangValidator \
-DOpenMP_C_FLAGS=-fopenmp=lomp \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES=libomp \
-DOpenMP_CXX_LIB_NAMES=libomp \
-DOpenMP_libomp_LIBRARY=$(brew --prefix)/opt/libomp/lib/libomp.dylib \
-DOpenMP_CXX_FLAGS=\"-Xpreprocessor -fopenmp $(brew --prefix)/opt/libomp/lib/libomp.dylib -I$(brew --prefix)/opt/libomp/include\" \
-DOpenMP_CXX_LIB_NAMES=libomp \
-DOpenMP_C_FLAGS=\"-Xpreprocessor -fopenmp $(brew --prefix)/opt/libomp/lib/libomp.dylib -I$(brew --prefix)/opt/libomp/include\"" FORCE_CMAKE=1 pip install --no-binary=llama-cpp-python --no-cache-dir -v llama-cpp-python

(NOTE: These args are derived from what I used to compile a MoltenVK/Vulkan build of llama.cpp using a version of llama.cpp that is from June 2025.

GGML Metal backend runs when you run the server.

Dominant language
Python
Stars
10.6k
Forks
1.5k
Avg merge
23m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abetlen/llama-cpp-python

All issues in abetlen/llama-cpp-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.