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 git is 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

  1. Open PowerShell.
  2. Type the command for the tool (e.g., cmake --version).
  3. If you see a version number, it’s in your PATH.
  4. 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:

  1. Find the Tool’s Folder: Locate the folder where the program’s .exe file lives.
    • Example for CMake: C:\Program Files\CMake\bin
  2. Open Environment Settings:
    • Press the Win key.
    • Search for “Edit the system environment variables” and press Enter.
  3. Edit Variables:
    • In the window that appears, click the Environment Variables… button at the bottom.
  4. Update the System Path:
    • Under the System variables section (the bottom half), find the variable named Path and click Edit….
    • Click New on the right side.
    • Paste the full path to your tool’s folder (e.g., C:\Program Files\CMake\bin).
  5. 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:

VariablePurpose
PATHAllows you to run git, cmake, python, nvcc, etc., from anywhere.
CUDA_PATHAutomatically set by the NVIDIA CUDA Toolkit; tells software where CUDA lives.
HIP_PATHAutomatically set by the AMD HIP SDK; tells software where HIP lives.

Last Updated: 2026-05-03