Prerequisites
Before you attempt to build or run llama.cpp on Windows, you must have several essential tools installed and configured. This guide is designed for beginners; if you are unsure about any of these, follow the provided instructions carefully.
🧠 Key Concepts for Beginners
If you are new to programming or software installation, these terms might sound intimidating. Here is what they actually mean:
- Compiler (e.g., MSVC): Think of a compiler as a translator. The
llama.cppcode is written in a language called “C++” which humans can read. A computer only understands 1s and 0s. The compiler translates the human-readable code into a machine-readable program (an.exefile). - Build System (e.g., CMake): Think of CMake as a construction manager. It doesn’t build the house itself, but it reads the blueprints (the code) and tells the workers (the compiler) exactly which tools to use and in what order to build the house.
- Version Control (e.g., Git): Think of Git as a time machine. It allows you to download a specific version of the code and keeps track of every change made to it. It’s how we “clone” (download) the project.
- Environment Variable (e.g., PATH): Think of the PATH as your computer’s address book. When you type a command like
git, your computer looks in its “address book” to find out where thegit.exeprogram is actually located on your hard drive.
📦 Core Software Requirements
These tools are required for all installation methods (CPU, CUDA, or AMD).
1. Git
Git is used to download (clone) the llama.cpp source code from GitHub.
- How to install: Download and install from git-scm.com.
- Verification: Open a terminal (PowerShell or Command Prompt) and type:
git --version
2. CMake
CMake manages the build process. It ensures the “construction manager” knows how to use your “translator” (compiler).
- How to install: Download the “Windows x64 Installer” from cmake.org/download.
- Crucial Step: During installation, select “Add CMake to the system PATH for all users”.
- Verification: Type in your terminal:
cmake --version
3. Visual Studio (MSVC Compiler)
To actually turn the code into a working program, you need a C++ compiler. On Windows, the standard is the Microsoft Visual C++ (MSVC) compiler.
- How to install:
- Download the Visual Studio Installer.
- Choose the “Community” version (it’s free).
- In the “Workloads” tab, you MUST check the box for “Desktop development with C++“. This includes the MSVC compiler, Windows SDK, and CMake tools.
- Verification: The easiest way is to ensure the “Desktop development with C++” workload is marked as installed in the Visual Studio Installer.
4. Python (Recommended)
While not strictly required for the core build, many llama.cpp utilities (like converting model files) require Python.
- How to install: Download from python.org.
- Crucial Step: During installation, check the box “Add Python to PATH”.
- Verification: Type in your terminal:
python --version
🚀 Backend-Specific Requirements
If you intend to use a GPU for faster performance, you will need additional software.
For NVIDIA Users (CUDA)
If you have an NVIDIA graphics card and want to use it:
- Requirement: NVIDIA CUDA Toolkit.
- Installation: Follow the standard Windows installer.
For AMD Users (ROCm/HIP)
If you have an AMD graphics card and want to use it:
- Requirement: AMD HIP SDK.
- Installation: Follow the installer provided by AMD.
⚙️ Environment Variables (The “PATH”)
When you install tools like Git, CMake, or Python, they must be added to your system’s PATH. This allows you to run commands like git or cmake from any folder in your terminal.
How to check if a tool is in your PATH:
- Open PowerShell.
- Type the command for the tool (e.g.,
cmake --version). - If you see a version number, it’s in your PATH.
- If you see
"The term 'cmake' is not recognized...", it is NOT in your PATH.
How to add a tool to PATH (if needed):
- Press the
Winkey and search for “Edit the system environment variables”. - Click Environment Variables at the bottom right.
- Under System variables, find the variable named
Pathand click Edit. - Click New and paste the full path to the folder containing your tool’s executable (e.g.,
C:\Program Files\CMake\bin). - Click OK on all windows and restart your terminal.
✅ Pre-Installation Checklist
Before proceeding to the installation guides, ensure you can run these commands successfully in a new PowerShell window:
-
git --version -
cmake --version -
python --version - (If using NVIDIA)
nvcc --version - (If using AMD)
hipconfig --version(or similar HIP check)
Last Updated: 2026-05-03