llama.cpp needs both its command-line programs and compatible native libraries to run local models. Homebrew installs those components together on supported macOS and Linux systems without a manually maintained source build.
The Homebrew community maintains the llama.cpp formula, which provides llama-cli and llama-server. Homebrew installs supporting libraries such as ggml and OpenSSL as dependencies and uses bottled packages when one is available for the platform.
A working Homebrew installation with its prefix on PATH is required. Model weights are separate from the formula, so checking the installed tools does not require a GGUF download.
Steps to install llama.cpp with Homebrew:
- Update Homebrew and its formula metadata.
$ brew update ==> Updating Homebrew... Already up-to-date.
- Install the llama.cpp formula as your regular user.
The installation writes to the Homebrew prefix and adds dependencies. Formula installation does not need sudo.
$ brew install llama.cpp ##### snipped ##### ==> Installing llama.cpp ==> Pouring llama.cpp--0.7.0.arm64_linux.bottle.tar.gz 🍺 /home/linuxbrew/.linuxbrew/Cellar/llama.cpp/0.7.0: 69 files, 31.7MB
The formula version and bottle name change with releases and platforms. On Apple Silicon macOS, Homebrew's default prefix is /opt/homebrew.
- Confirm that Homebrew records the installed package.
$ brew list --versions llama.cpp llama.cpp 0.7.0
- Check that the shell resolves llama-cli from the Homebrew prefix.
$ command -v llama-cli /home/linuxbrew/.linuxbrew/bin/llama-cli
A path outside the Homebrew prefix can mean another installation comes first on PATH. On Apple Silicon macOS, the default Homebrew command path is /opt/homebrew/bin/llama-cli.
- Check that the shell resolves llama-server from the same prefix.
$ command -v llama-server /home/linuxbrew/.linuxbrew/bin/llama-server
- Verify that the installed llama-cli starts.
$ llama-cli --version version: 0.7.0 (build 11669, commit 620d2225c) built with GNU 13.3.0 for Linux aarch64
The version, commit, compiler, and architecture reflect the installed formula and platform.
- Verify that the installed llama-server starts.
$ llama-server --version version: 0.7.0 (build 11669, commit 620d2225c) built with GNU 13.3.0 for Linux aarch64
Both executables are available without loading a model. Inference and API requests require a separate GGUF model.
Related: Run a local GGUF model with llama.cpp
Related: Start the llama.cpp server