How to Install llama.cpp for Local LLM on CPU (2026)

Quick answer

To install llama.cpp for local LLM on CPU, install it with the official installer or build it from source with CMake, then run a small GGUF model with llama cli and keep GPU layers at zero. The server, when you need one, binds to 127.0.0.1 by default. llama.cpp costs $0 in software under the MIT licence; against ChatGPT Plus at $20 a month for one person, a solo owner on a machine already owned saves $240 a year, in exchange for slower replies and choosing a model that fits the RAM.

No graphics card, no monthly AI bill, and no prompts leaving the building. That is the promise that sends small business owners looking at llama.cpp, and it is a fair promise, as long as you pick a model your processor can actually carry.

llama.cpp is the free, open-source engine that runs large language models on ordinary hardware, including a plain CPU. This guide shows how to install llama.cpp for local LLM on CPU step by step, with every command, licence rule and limit checked on the official llama.cpp GitHub repository and documentation on 1 December 2026.

Quick Answer

To install llama.cpp for local LLM on CPU, install it with the official installer or build it from source with CMake, then run a small GGUF model with llama cli and keep GPU layers at zero. The server, when you need one, binds to 127.0.0.1 by default.

llama.cpp costs $0 in software under the MIT licence. Against ChatGPT Plus at $20 a month for one person, a solo owner on a machine already owned saves $240 a year, in exchange for slower replies and the job of choosing a model that fits the RAM.

In this article

  • How we checked this guide
  • What llama.cpp replaces, and what it does not
  • Install routes at a glance
  • Requirements before you install
  • Step 1: install llama.cpp on CPU
  • Step 2: run your first model in the terminal
  • Step 3: run the local server safely
  • First-run security steps
  • Make llama.cpp useful: models, quantizations and speed
  • Backup and update routine
  • Common errors and fixes
  • Tips and tricks that save time
  • The real cost maths: self-hosted versus subscription
  • When not to self-host
  • Pros and cons
  • Our verdict
  • FAQ
  • Strategic Pivot: price your own stack before you buy
  • Sources

How we checked this guide

Every install command, build flag, server default and licence statement in this post was checked on the official llama.cpp GitHub repository on 1 December 2026. That covers the repository README, the official build guide, and the server documentation. The one paid price used for comparison, ChatGPT Plus at $20 a month, was checked on the official OpenAI Help Center page the same day.

Where the official pages do not publish a number, we say so instead of guessing. llama.cpp does not publish one flat minimum RAM figure, because the model you choose decides almost all of the memory need. We therefore size the machine by the model file, the context length, and honest headroom.

What llama.cpp replaces, and what it does not

llama.cpp replaces the subscription inference bill, not the model itself. It is an inference engine written in C and C++, built on the ggml library, and its stated goal is LLM inference with minimal setup and strong performance on a wide range of hardware, locally and in the cloud. You still choose and download a model, in GGUF format, and the engine runs it.

Best for: a solo owner or freelancer with a CPU-only PC who wants private drafting, summarising and chat without a per-seat subscription. Skip if: you need frontier-model quality for hard reasoning, fast replies for a customer-facing chat, or nobody on the team will own updates. A CPU can run a small model well. It cannot make a small model think like a large hosted one.

That split matters for expectations. When a reply is slow, the cause is usually the model size, the quantization, and the context length on your processor, not a broken install. When a login, a shared chat window or a team model list is missing, that is a different layer. Our guide to install Ollama on Ubuntu covers the friendlier wrapper, and our guide to install Open WebUI with Ollama covers the browser window. llama.cpp is the engine underneath both ideas, with the fewest moving parts.

Install routes at a glance

The official README gives four practical routes. The table below compares them for a CPU-only small business machine. For most readers, the installer is the fastest honest start, and the source build is the route that gives the most control.

RouteOfficial sourceBest forWatch out
Official installer scriptREADME Quick startFastest first run on Linux or macOSIt fetches and runs a script, so read it first if that matters to you
Pre-built binariesGitHub releases pageNo compiler, pinned versionPick the archive that matches your operating system and CPU
Build from source with CMakeOfficial build guideExact control, CPU-only build, repeatable updatesNeeds Git, CMake and a C++ compiler
DockerOfficial Docker documentationIsolated server runsExtra layer to learn if you only want terminal chat

Best for the installer: an owner who wants a first answer today. Skip if: your policy forbids pipe-to-shell installs, in which case download a release binary or build from source. Best for the source build: anyone who will update often and wants the same build every time. Skip if: you have never used a terminal and only want a chat window, where Ollama plus Open WebUI is kinder.

Official llama.cpp GitHub repository page showing the public ggml-org llama.cpp project and MIT licence
The official llama.cpp GitHub repository, checked 1 December 2026. The project describes itself as LLM inference in C/C++ and is released under the MIT licence.

Requirements before you install

You need three things: a 64-bit computer, enough free RAM for the model you pick, and disk space for the model file. The engine itself is small. The model is the weight. A quantized small model can be under a gigabyte, while larger models run to many gigabytes, so the download you choose sets the real requirement.

Plan RAM by addition, not by hope. The model file must fit, the context cache grows with the context length you set, and the operating system and your other apps still need room. If the total exceeds free RAM, the machine swaps to disk and generation crawls. Start with a small model and a modest context, confirm the speed, then step up one size at a time.

For the source build you also need Git, CMake and a C++ compiler. On Debian or Ubuntu, the official build guide notes that OpenSSL development libraries are optional: install libssl-dev if you want HTTPS and TLS features, and the project builds and runs without SSL support if you do not. On Windows, the build guide points to Visual Studio 2022 with the Desktop development with C++ workload.

The licence is the easy part. llama.cpp is released under the MIT licence, which in plain words means you may use, copy, modify and distribute the software, including commercially, as long as the copyright and permission notices stay with it. The model you download carries its own licence, separate from the engine, so check the model page before any commercial use.

Step 1: install llama.cpp on CPU

Start with the route that matches your comfort. The official README Quick start gives the installer commands directly. On Linux or macOS, the curl route is:

curl -LsSf https://llama.app/install.sh | sh

On Windows, the PowerShell route is:

irm https://llama.app/install.ps1 | iex

The README also points to llama.app for guided instructions, to Docker, and to pre-built binaries on the releases page. Whichever route you take, confirm the install by asking the tool for its version and help output before you download any model. If the command is not found, the install folder is probably not on your PATH yet, which the installer output will name.

To build from source instead, clone the official repository and build the CPU configuration with CMake, exactly as the official build guide describes:

git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
cmake -B build
cmake --build build --config Release

Add the -j flag to compile with parallel jobs, for example -j 8 for eight jobs, if your machine has the cores to spare. The build guide also notes ccache for faster repeated compilation, which pays off once you start updating regularly. A CPU build needs no GPU flag. GPU backends such as CUDA, Metal and Vulkan are separate build options, and leaving them out is what keeps this a CPU install.

Official llama.cpp build guide text showing the git clone command and CPU build section
The official llama.cpp build guide, checked 1 December 2026. A CPU build needs only the clone, cmake -B build and cmake –build build –config Release commands.

Step 2: run your first model in the terminal

llama.cpp runs models in GGUF format, a single file that holds the weights and the metadata the engine needs. The official README shows the shortest first run: download and run a model directly from Hugging Face.

llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF

That example uses a small model published by the project team, which is the right size class for a first CPU test. A small model proves the install, the download path and the terminal chat in minutes. It also keeps the RAM question honest, because a model this size fits almost any modern machine.

For CPU-only running, keep GPU layers at zero. The server documentation lists -ngl, also written –n-gpu-layers, as the maximum number of layers to store in VRAM. On a CPU-only build there is no VRAM to offload to, and on a mixed build the value 0 keeps the model on the processor. If your build was compiled with a GPU backend by mistake, the startup log will show the backend and the offloaded layer count, which is your clue.

Context length is the second dial. The -c flag, also written –ctx-size, sets the size of the prompt context, and the documentation notes that 0 loads the value from the model. A larger context lets the model hold more of a long document, and it also grows the memory the run needs. For a first CPU test, a modest context such as 2048 keeps memory predictable while you judge speed and quality.

Once the chat answers, test the three jobs a small business actually repeats: draft a short email from bullet points, summarise a page of notes, and rewrite a product description in a plainer tone. Judge those outputs, not a benchmark. If the small model handles your real text at a speed you can tolerate, you have a working local tool. If it does not, the fix is a better-fitting model, not a reinstall.

Step 3: run the local server safely

Terminal chat serves one person. The server serves your other tools. llama.cpp ships an HTTP server with OpenAI-compatible chat completions, responses and embeddings routes, plus Llama Chat, a built-in chat app. The README shows the launch command:

llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF

The server loads the model once and answers over HTTP, which is what lets a script, a spreadsheet add-in or another local app use the same model without reloading it each time. The documentation also lists parallel decoding with multi-user support and continuous batching, which help when more than one request arrives at once. On a CPU, parallel requests still share the same processor, so treat multi-user as convenience, not capacity.

Keep the default binding. The server documentation lists –host with a default of 127.0.0.1, which means the server listens only on the same machine. That is the safe default for a business PC. Changing the host to listen on all interfaces exposes the model to the whole network, and it should only happen behind a deliberate decision, never as a copy-pasted fix for a connection error.

Set an API key before any wider use. The documentation lists –api-key for authentication, with a default of none, and –api-key-file for a file of keys, one per line. No key plus a network-wide binding is the exact combination that turns a private model into a public one. For a single-machine setup, the loopback default alone is reasonable. For anything beyond that, a key is the minimum.

Official llama.cpp server documentation text listing HTTP server features and usage parameters
The official llama.cpp server documentation, checked 1 December 2026. The server binds to 127.0.0.1 by default and takes an optional API key for authentication.

First-run security steps

Treat the first run as a checklist, not a celebration. Confirm the server answers on 127.0.0.1 and not on your network address. Confirm no firewall rule was added by habit. Confirm the model folder holds only models you chose, from repositories you trust, because a GGUF file is data your engine loads and runs.

Keep prompts local by design. A CPU install on your own machine sends nothing to a vendor, which is the privacy gain that justifies the slower replies. That gain disappears the moment you paste the same text into a hosted tool for a second opinion, so decide which documents are local-only and keep that rule boring and consistent.

Update the engine on a schedule you control. The project publishes frequent releases, and the changelog is the place to check what changed. Pin a version you have tested for daily work, and try new releases on a copy of your setup first. A model that answers well today should not break because an update landed during a busy week.

If you later want a friendlier window over the same local models, our guide to install Open WebUI with Ollama adds logins and chat history. llama.cpp itself stays the lean engine underneath, and its server already speaks the OpenAI-compatible routes that other local tools expect.

Make llama.cpp useful: models, quantizations and speed

The model choice decides whether CPU inference feels clever or painful. GGUF files come in quantizations, which store the weights at reduced precision. A heavier quantization keeps more quality and uses more memory. A lighter one fits smaller machines and answers faster, with some quality given up. The Hugging Face option in the documentation defaults to Q4_K_M when the repository offers it, which is a sensible first candidate for chat.

Size the model to the job. Short emails, summaries and rewrites suit a small instruct model. Long documents need context more than they need parameter count, so a small model with a context that fits your document beats a large model that swaps. Code help and careful reasoning are where small CPU models show their limits first, and no install trick removes that ceiling.

Threads are the third dial. The documentation lists -t, also written –threads, as the number of CPU threads to use during generation, with a default that lets the engine decide. More threads help up to the point where the machine is busy with your other work. If the whole PC stutters during generation, fewer threads will feel better even if the raw tokens per second dip slightly.

Measure before you tune. The project ships benchmarking tools, and the documentation links a performance troubleshooting guide for exactly this work. Change one dial at a time: model size, then quantization, then context, then threads. Write down the tokens per second and the memory use after each change. Tuning by feel wastes an afternoon. Tuning by numbers takes twenty minutes.

For a small business, the useful shape is boring: one small instruct model that fits comfortably, a context that covers a typical document, the server on loopback, and a short list of prompts you reuse. That setup drafts, summarises and rewrites all day at no per-message cost. It will not replace a hosted frontier model for the hardest questions, and pretending otherwise is how local AI gets a bad name.

Backup and update routine

Back up the model files and your configuration, not the whole build folder. Models are large downloads you would rather not fetch again on a slow connection, and your chosen flags, keys file and prompt list are small text that rebuilds the setup in minutes. Keep one copy on a second drive, and note the exact model repository and quantization beside it.

Update by replacement, not by patching in place. For a source build, pull the new code, rebuild into a fresh build folder, and run the same model with the same flags. If the new build answers well, keep it and delete the old folder. If it misbehaves, the old build is still there. For release binaries, keep the previous archive until the new one has passed a real task.

Re-test after every update with the same three jobs: one draft, one summary, one rewrite. Updates can change defaults, and a changed default context or thread count can quietly alter speed or memory. The changelog tells you what the project intended. Your three jobs tell you what your machine actually does now.

Common errors and fixes

The command is not found after install. The binary folder is not on your PATH, or the shell has not picked up the change. Open a new terminal, check the path the installer printed, and confirm with the version flag before downloading any model.

The model loads, then the machine slows to a crawl. The model plus context exceeds free RAM and the system is swapping. Drop to a smaller quantization, reduce the context length, and close heavy apps before judging the engine. Swapping is a sizing error, not a llama.cpp fault.

Generation is far slower than expected. Check the startup log for the compiled backend and the offloaded layer count. A build compiled without the backend you expected still runs, at CPU speed, while appearing to succeed. On a CPU-only machine that is correct behaviour. On a machine with a GPU, rebuild with the matching backend flag from the official build guide.

The server answers on the same machine but not from another device. That is the 127.0.0.1 default doing its job. Decide deliberately whether wider access is wanted. If it is, set an API key first, bind intentionally, and put the machine behind your normal network controls. Never widen the binding just to make an error message go away.

The download stalls or the model file fails to load. Confirm the repository name and quantization exist, confirm free disk space, and re-download rather than repairing a partial file. A truncated GGUF file will not load cleanly, and a fresh download is faster than detective work.

Tips and tricks that save time

Start smaller than your pride suggests. A tiny model that answers in seconds teaches you the workflow, the flags and the real quality bar for your text. Stepping up one size at a time keeps every change measurable, and it stops the classic mistake of blaming the engine for a model the machine cannot carry.

Reuse one good prompt shape. Local models reward clear structure: the task, the audience, the length, and the tone, in that order. Save the shapes that work for your invoices, product descriptions and customer replies. A saved prompt that works is worth more than a larger model prompted vaguely.

Keep the server for tools and the terminal for tests. The terminal proves a model and a flag set quickly. The server then gives your scripts and local apps one stable address. Mixing the two, with three half-configured servers on three ports, is how a tidy setup becomes folklore nobody can reproduce.

Write your flags down. The model path, quantization, context, threads and host binding that work belong in a small text file beside the model. When an update changes a default, that file is the difference between a five-minute restore and an evening of guessing.

The real cost maths: self-hosted versus subscription

llama.cpp itself costs $0. The MIT licence means no licence fee, no per-seat charge and no per-message metering from the project. The model download is also free of charge from its repository, subject to that model’s own licence. The only costs are the machine you already own, its electricity, and your time.

ChatGPT Plus costs $20 a month for one person on the official OpenAI Help Center page, checked 1 December 2026. That is $240 a year for one seat. A solo owner who moves daily drafting and summarising to a CPU model on an existing PC therefore saves the full $240 a year in subscription terms, and keeps the prompts on the machine.

SetupSoftware cost per yearWhat you give up
llama.cpp on an existing CPU PC$0Frontier quality, instant replies, zero maintenance
ChatGPT Plus, one person$240Privacy of local prompts, offline use
ChatGPT Plus, five people$1,200Same, multiplied by seats

The five-seat line shows where local inference earns its keep. Five individual Plus subscriptions cost $1,200 a year. One shared llama.cpp server on an office machine costs $0 in software, with the honest limits stated plainly: replies queue on one processor, quality is that of the small model you chose, and someone owns updates and backups.

ChatGPT official pricing page showing Free, Go, Plus and Pro plans
The official ChatGPT pricing page, checked 1 December 2026. Plus is $20 a month, which is $240 a year for one person.

Electricity is the cost owners ask about, and it is real but modest for intermittent office use. A CPU generating text draws more power than an idle PC, and a machine left serving all day draws more than one used for an hour of drafting. The official pages publish no wattage figure for your hardware, so we will not invent one. Measure your own machine if the number matters, and compare it against $240 a year, not against zero.

The lean choice is llama.cpp alone on the PC you own, at $0 a year, for drafting, summarising and rewriting. The full stack adds a hosted subscription for the hardest questions. Many owners land in the middle: local for private and routine text, hosted for rare difficult work, with the subscription kept only if the hard questions arrive often enough to justify $240.

When not to self-host

Do not self-host when the work needs frontier reasoning every day. A small CPU model will draft and summarise well, and it will also produce confident errors on hard analysis. If wrong answers cost money, pay for the stronger hosted model and keep llama.cpp for the routine text.

Do not self-host when nobody owns the machine. Updates, backups, model choices and the occasional broken default all need a named person. A server nobody maintains becomes either a security risk or a museum piece, and both outcomes cost more than a subscription.

Do not self-host for customer-facing chat at volume. CPU generation speed and single-machine capacity suit internal drafting. A public chat that must answer many visitors quickly belongs on hosted infrastructure built for that load.

Do not self-host when your only computer is already struggling. If the PC swaps during normal work, a local model will make the whole day slower. In that case the honest order is a hosted subscription now, and local inference later on hardware with headroom.

Pros and cons

Pros:

  • $0 software cost under the MIT licence, with no per-seat or per-message metering.
  • Runs on a plain CPU, with no graphics card required.
  • Prompts and documents stay on your machine, and the tool works offline once the model is downloaded.
  • One engine covers terminal chat and an OpenAI-compatible local server.
  • Model choice is yours, sized to your RAM and your actual jobs.

Cons:

  • Replies are slower than hosted models, and small models are weaker at hard reasoning.
  • You own model selection, updates, backups and the occasional broken default.
  • Memory sizing is manual: model, quantization and context must fit your RAM.
  • No built-in team accounts in the engine itself; wider access needs your own controls.

Our verdict

Install llama.cpp if your daily AI work is drafting, summarising and rewriting, your documents deserve to stay local, and your PC has RAM to spare. Start with the official installer or a CPU source build, prove it with a small GGUF model, keep the server on 127.0.0.1, and step the model up only while the speed stays tolerable.

Skip it, for now, if your work needs frontier answers daily or nobody will maintain the machine. In that case a hosted subscription is the cheaper honest tool, and our comparison of best AI chatbots and ChatGPT alternatives for small business owners will help you choose one. For owners who do install it, llama.cpp is the rare free tool that stays free at every seat count, which is exactly why it leads this open-source series.

FAQ

Can llama.cpp run without a GPU?

Yes. llama.cpp is built to run models on a CPU, and the official build guide gives a plain CMake CPU build with no GPU flag. Keep GPU layers at zero, choose a model and quantization that fit your RAM, and expect slower replies than a graphics card would give.

How much RAM do I need for llama.cpp on CPU?

The project publishes no single minimum, because the model decides the need. Add the model file size, the context cache for your chosen context length, and headroom for your operating system and apps. If the total exceeds free RAM, the machine swaps and generation crawls, so start small and step up.

Is llama.cpp free for commercial use?

The engine is released under the MIT licence, which permits commercial use with the copyright and permission notices kept. The model you download has its own licence, separate from the engine, so check the model repository terms before using its output in a business.

What is a GGUF file?

GGUF is the model file format llama.cpp loads. One file holds the model weights and the metadata the engine needs, including the architecture and tokenizer information. Quantized GGUF files store the weights at reduced precision, which is what lets a model fit and run on a CPU.

Is the llama.cpp server safe to expose on my network?

Not by default, and not without controls. The server binds to 127.0.0.1 by default, which keeps it on the same machine, and the API key default is none. Before any wider binding, set an API key, bind deliberately, and keep the machine behind your normal network controls.

Strategic Pivot: price your own stack before you buy

Before you pay for any AI subscription, price the stack you already own. Run your real monthly jobs, drafting, summarising, rewriting and answering, through the AI Cost Calculator and compare the hosted total against a $0 local engine on your existing PC. The calculator keeps the comparison honest, because it counts seats and usage instead of headline prices. Owners who want the wider free-tool picture can also read our guide to free AI tools for small business that are actually free.

Price note — updated 1 December 2026: Prices in this post were checked on 1 December 2026. When you are reading this, the price may be lower or higher, so check the official pricing page before buying. llama.cpp is free under the MIT licence; the ChatGPT Plus figure comes from the official OpenAI Help Center page.

Sources

Pros

  • $0 software cost under the MIT licence, with no per-seat or per-message metering.
  • Runs on a plain CPU, with no graphics card required.
  • Prompts and documents stay on your machine, and the tool works offline once the model is downloaded.
  • One engine covers terminal chat and an OpenAI-compatible local server.
  • Model choice is yours, sized to your RAM and your actual jobs.

Cons

  • Replies are slower than hosted models, and small models are weaker at hard reasoning.
  • You own model selection, updates, backups and the occasional broken default.
  • Memory sizing is manual: model, quantization and context must fit your RAM.
  • No built-in team accounts in the engine itself; wider access needs your own controls.
Our verdict

Install llama.cpp if your daily AI work is drafting, summarising and rewriting, your documents deserve to stay local, and your PC has RAM to spare. Start with the official installer or a CPU source build, prove it with a small GGUF model, keep the server on 127.0.0.1, and step the model up only while the speed stays tolerable. Skip it, for now, if your work needs frontier answers daily or nobody will maintain the machine; in that case a hosted subscription is the cheaper honest tool. For owners who do install it, llama.cpp is the rare free tool that stays free at every seat count.

1 thought on “How to Install llama.cpp for Local LLM on CPU (2026)”

Leave a Comment