New Tool Radar

Local Model Setup

How to Build llama.cpp From Source and Run a Model

Clone llama.cpp, build it with CMake, and run a model from the command line with llama-cli.

Schematic diagram with four steps: clone the llama.cpp repository, build it with CMake, run a model from Hugging Face with llama cli, then chat with the model.

llama.cpp is the C/C++ inference engine behind many local AI apps, and building it from source is the route when you need a specific backend — CUDA, Metal, Vulkan — or the newest code. The build is a standard CMake build, and the first run can download a model straight from Hugging Face.

Clone, build and run

Clone the repository and build it: cmake -B build followed by cmake --build build -j --config Release. The binaries land in build/bin, including the server and the quantiser. Then run a model directly from Hugging Face with the CLI: llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF downloads the model and starts a chat. The same pattern starts the server: llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF.

git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --config Release
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF

The project’s goal, in its own README, is LLM inference with minimal setup and state-of-the-art performance on a wide range of hardware, locally and in the cloud. If you do not want to build, the project also publishes prebuilt binaries and an install script — building is for when you need control over the backends.

Try it: four checks

Check What you should see If you do not see it
Clone succeeds The llama.cpp folder contains CMakeLists.txt Check git and network access
Build finishes cmake –build completes and build/bin has binaries Check the compiler and CMake version
Model downloads llama cli -hf fetches the model Check the Hugging Face repo name
Chat answers The CLI chat replies to a prompt Check the model finished downloading

Expected result. We checked the llama.cpp README content as published, which gives the cmake build commands, the build/bin output, and the llama cli -hf and llama serve -hf quick start. We did not build llama.cpp on this machine.

Limits

This guide covers the basic CMake build only. Backend-specific build flags (CUDA, Metal, Vulkan) are separate choices. We did not test the build ourselves.

Sources

See all