Environment Variables
To run llama.cpp commands from any folder in your terminal, the folder containing your tools must be included in your system’s PATH environment variable.
🧠 Key Concepts for Beginners
What is an Environment Variable?
Think of an environment variables as global settings for your computer. It’s a way for different programs to share information (like “Where is my home folder?” or “What language should I speak?”).
What is the “PATH”? (The Library Analogy 📚)
Imagine you are in a massive library. You want to find a book called git.
- Without a PATH: You would have to walk to the exact shelf, in the exact aisle, in the exact room where
gitis kept, every single time you wanted to use it. - With a PATH: You tell the librarian, “Whenever I ask for a book, check these 5 specific aisles first.” The librarian (your computer) then knows exactly where to go automatically.
The PATH is that list of “aisles” (folders) where your computer looks for programs.
🔍 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 your PATH (if needed)
If you’ve installed a tool but can’t run it from the terminal, follow these steps:
- Find the Tool’s Folder: Locate the folder where the program’s
.exefile lives.- Example for CMake:
C:\Program Files\CMake\bin
- Example for CMake:
- Open Environment Settings:
- Press the
Winkey. - Search for “Edit the system environment variables” and press Enter.
- Press the
- Edit Variables:
- In the window that appears, click the Environment Variables… button at the bottom.
- Update the System Path:
- Under the System variables section (the bottom half), find the variable named
Pathand click Edit…. - Click New on the right side.
- Paste the full path to your tool’s folder (e.g.,
C:\Program Files\CMake\bin).
- Under the System variables section (the bottom half), find the variable named
- Save and Restart:
- Click OK on all three windows.
- IMPORTANT: You must close and re-open any open terminal windows for the changes to take effect.
📋 Common Variables for AI Workflows
While llama.cpp doesn’t rely on many specific variables, you will often interact with these:
| Variable | Purpose |
|---|---|
PATH | Allows you to run git, cmake, python, nvcc, etc., from anywhere. |
CUDA_PATH | Automatically set by the NVIDIA CUDA Toolkit; tells software where CUDA lives. |
HIP_PATH | Automatically set by the AMD HIP SDK; tells software where HIP lives. |
Last Updated: 2026-05-03