Install Xcode Command Line Tools:
xcode-select --installInstall Homebrew (if needed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install Rust (stable):
brew install rustup-init
rustup-init -y
source "$HOME/.cargo/env"Install Git and CMake:
brew install git cmakegit clone --recursive https://github.com/eugenehp/llama-cpp-rs
cd llama-cpp-rsIf already cloned without submodules:
git submodule update --init --recursivecargo buildThis project now supports a graceful fallback on macOS:
- If Vulkan SDK is available and complete,
--features vulkanbuilds with Vulkan. - If Vulkan SDK is missing/incomplete,
--features vulkanautomatically falls back to Metal.
The Vulkan availability check expects:
VULKAN_SDKset- Vulkan headers at
$VULKAN_SDK/include/vulkan/vulkan.h - Vulkan or MoltenVK library in
$VULKAN_SDK/lib glslcavailable inPATH
Build command:
cargo build --features vulkanWhen Vulkan is unavailable on macOS, you should see a cargo warning indicating fallback to Metal.
cargo build --features metal- These instructions are documented for macOS but were not executed in this Ubuntu environment.
- CI currently validates Vulkan builds on Linux and Windows; macOS fallback behavior is implemented in
llama-cpp-sys-4/build.rs.