Skip to content

fix: respect GGML_METAL=OFF on macOS - #2370

Open
provoke210 wants to merge 1 commit into
abetlen:mainfrom
provoke210:fix/respect-macos-metal-option
Open

provoke210 wants to merge 1 commit into
abetlen:mainfrom
provoke210:fix/respect-macos-metal-option

Conversation

@provoke210

Copy link
Copy Markdown

Fixes #2050.

On macOS, -DGGML_METAL=OFF is overwritten by the Apple configuration block: the CMake cache ends up with GGML_METAL:BOOL=ON and the Metal backend is still built. Remove FORCE from that cache assignment so an explicit user setting is preserved while Metal remains enabled by default on both Apple architectures.

The embedded Metal library setting is unchanged. This also adds an Unreleased changelog entry.

Validation

Tested on Apple M5 / macOS 26.5 (arm64), Python 3.12.14, CMake 4.4.3, against main d73664636c2e3b25ce5949a9b85bba690684cdf3 and its unchanged llama.cpp submodule 5266f24da75dc449bd56cbed7addb9c8e4a6a73e.

  • Before the fix, configuring with -DGGML_METAL=OFF produces GGML_METAL:BOOL=ON and a ggml-metal target.
  • After the fix, fresh default and explicit-ON configurations keep Metal enabled; a fresh explicit-OFF configuration keeps it disabled and has no Metal target. Reconfiguring an existing build ON → OFF → ON also updates the cache and target graph correctly.
  • Built a fresh wheel with CMAKE_ARGS="-DGGML_METAL=OFF" CMAKE_BUILD_PARALLEL_LEVEL=6 python -m build --wheel --no-isolation, then installed it into the test environment. An isolated import confirms the installed wheel is used, contains no Metal library, and reports llama_supports_gpu_offload() == False.
  • HF_HUB_OFFLINE=1 python -I -m pytest -q: 26 passed, including the existing generation, embedding, and recurrent/hybrid cache tests with their downloaded model fixtures.
  • python -m ruff check llama_cpp tests, python -m ruff format --check llama_cpp tests, and git diff --check: passed.

The Metal-enabled configurations were configured but not compiled. Intel macOS, Linux, and Windows execution were not tested locally.

AI assistance: OpenAI Codex assisted with implementation, review, local validation, and this PR description.

Assisted-by: OpenAI Codex
Signed-off-by: Haozhe Jiang <162801044+provoke210@users.noreply.github.com>
@provoke210
provoke210 force-pushed the fix/respect-macos-metal-option branch from 2ca5c8d to 0e61ee9 Compare September 22, 2026 07:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant