llamafile lets you run a large language model from a single file. Download one file, make it executable, double-click or run it, and you get a local chatbot plus a web server with an OpenAI-compatible API. There’s no Python, no installer and no separate runtime.
It’s a Mozilla project that combines llama.cpp with Cosmopolitan Libc, so the same file runs on Windows, macOS, Linux and BSD, on both x86-64 and ARM64 CPUs.
This guide shows how to run a llamafile on each operating system, use your GPU, use the server and API, load any GGUF model, build your own llamafile, and fix the common errors. It follows the official llamafile README and Mozilla AI docs for version 0.10.6.
- What: one executable file that contains a model and llama.cpp. Apache 2.0, by Mozilla AI.
- Mac/Linux:
chmod +x model.llamafile, then./model.llamafile. - Windows: rename the file to end in
.exe. Files over 4 GB need the external-weights method. - Server:
http://localhost:8080, OpenAI-compatible at/v1. - GPU: Metal is automatic on Apple Silicon; NVIDIA needs
-ngl 999. - Any GGUF:
llamafile -m model.gguf.
What llamafile Is
- One file: the model weights and the llama.cpp engine are packed into a single executable.
- Runs almost anywhere: Cosmopolitan Libc makes one binary work on Linux, macOS, Windows, FreeBSD, NetBSD and OpenBSD.
- Repo: github.com/mozilla-ai/llamafile. Latest release is v0.10.6, which updated the bundled llama.cpp.
- License: Apache 2.0, with changes to llama.cpp and whisper.cpp under MIT.
- Extras: whisperfile (speech to text) and transcribefile are built from the same project.
Version 0.10 introduced a new build system. The README notes that a few features from the older 0.9.x line may not have been carried over yet, so very old tutorials can show flags that no longer exist.
Ready-Made llamafiles and Sizes
| Model | File size | Good for |
|---|---|---|
| Qwen3.5 0.8B Q8 | 1.6 GB | Testing, old laptops |
| Qwen3.5 2B | 3.2 GB | Light chat |
| Ministral 3 3B Q4_K_M | 3.4 GB | Light chat |
| Qwen3.5 4B | 4.1 GB | Everyday use on 8 GB machines |
| LLaVA 1.6 Mistral 7B Q4 | 5.3 GB | Image understanding |
| Apertus 8B | 5.9 GB | General use |
| Qwen3.5 9B | 7.4 GB | Better answers, 16 GB RAM |
| gpt-oss 20B MXFP4 | 12 GB | Strong reasoning, 16 GB+ VRAM or 32 GB RAM |
| LFM2 24B | 16 GB | High-end PCs |
| Qwen3.5 27B | 19 GB | 24 GB GPUs or Macs with lots of memory |
These are the pre-built 0.10 llamafiles listed in the docs, hosted on Hugging Face under mozilla-ai. As a rule of thumb, you want a bit more free RAM (or VRAM) than the file size. Our RAM for local LLMs guide explains the maths.
Run a llamafile on Mac and Linux
- Download a llamafile, for example:
curl -LO https://huggingface.co/mozilla-ai/llamafile_0.10/resolve/main/Qwen3.5-0.8B-Q8_0.llamafile - Make it executable:
chmod +x Qwen3.5-0.8B-Q8_0.llamafile - Run it:
./Qwen3.5-0.8B-Q8_0.llamafile - Chat in the terminal, or open
http://localhost:8080in your browser.
On a Mac, the first run may ask you to allow the app in System Settings > Privacy & Security, and GPU support needs the Xcode Command Line Tools. On older zsh versions (before 5.9), start it with sh -c ./your.llamafile.
Run a llamafile on Windows
- Download a llamafile under 4 GB.
- Rename it so it ends in
.exe, for exampleQwen3.5-0.8B-Q8_0.llamafile.exe. - Open Command Prompt or PowerShell in that folder and run it, or double-click it.
- Open
http://localhost:8080to use the web chat.
The 4 GB limit: Windows won’t run executables larger than 4 GB. For bigger models, download the small llamafile program by itself, rename it to llamafile.exe, and point it at a separate GGUF file:
llamafile.exe -m gpt-oss-20b.gguf
Windows 10 or later on x64 is required. If you’d rather run Linux tools on Windows, see our WSL2 local AI setup.
Chat, Server and CLI Modes
| Command | What happens |
|---|---|
./model.llamafile |
Starts the web server and a terminal chat together |
./model.llamafile --server |
Server and web UI only |
./model.llamafile --chat |
Terminal chat only (/help lists commands, /upload adds an image) |
./model.llamafile --cli -p "prompt" |
One answer, then exit; add --image for vision models |
--host 0.0.0.0 |
Make the server reachable from other devices |
--port 8081 |
Use a different port |
--ctx-size 64000 |
Larger context window (uses more memory) |
Use the OpenAI-Compatible API
While the server runs, any OpenAI-style client can talk to it. The base URL is http://localhost:8080/v1, and the key can be any placeholder such as no-key.
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d '{"model":"local","messages":[{"role":"user","content":"Hello!"}]}'
In Python with the OpenAI SDK:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8080/v1", api_key="no-key")
r = client.chat.completions.create(model="local",
messages=[{"role": "user", "content": "Write a haiku about files"}])
print(r.choices[0].message.content)
The docs say the server also supports Anthropic’s Messages API format. Because it’s llama.cpp underneath, the server works much like our llama-server guide describes.
GPU Acceleration
| GPU | How to enable | Notes |
|---|---|---|
| Apple Silicon (Metal) | On by default | Needs Xcode Command Line Tools; disable with -ngl 0 |
| NVIDIA (CUDA) | -ngl 999 (or --gpu nvidia) |
Bundled library needs compute capability 7.5+ (RTX 20 series and newer) |
| AMD (ROCm/HIP) | -ngl 999 --gpu amd |
Experimental, separate library download |
| Any vendor (Vulkan) | --gpu vulkan |
Useful fallback |
-ngl sets how many model layers go to the GPU; 999 means all of them. If GPU setup fails, llamafile quietly falls back to the CPU, so add --verbose to see why.
Run Any GGUF Model
- Download the bare llamafile program from the official release or Hugging Face page and make it executable (or rename it to .exe on Windows).
- Download a GGUF model; see how to download models from Hugging Face.
- Run:
./llamafile -m model.gguf, adding-ngl 999for NVIDIA.
Got a model only in safetensors format? Convert it first with our convert to GGUF guide.
Create Your Own llamafile
- Build the tools from the llamafile repo, including zipalign:
make o//third_party/zipalign. - Write a
.argsfile with one argument per line, for example-m,/zip/model.ggufand--server. - Copy the llamafile binary to a new name:
cp o//llamafile/llamafile MyModel.llamafile. - Embed the model and args:
o//third_party/zipalign/zipalign -j0 MyModel.llamafile model.gguf .args. - Test it by running
./MyModel.llamafile. You can inspect any llamafile withunzip -vl.
Check the model’s license before sharing a llamafile you’ve built, since the weights travel inside the file.
Tips for Getting the Most From llamafile
- Start small. Try the 0.8B or 4B file first to check that everything works before downloading a 12 GB model.
- Keep models on a fast SSD. Loading a large file from a slow hard drive or USB 2 stick can take minutes.
- Put the GPU to work. On NVIDIA, always add
-ngl 999; without it, the model runs on the CPU. - Watch the context size. A bigger
--ctx-sizelets you paste long documents but uses more memory. - Carry it offline. A llamafile on a USB drive gives you a private assistant on any PC, with nothing to install.
llamafile vs Ollama vs LM Studio
| llamafile | Ollama | LM Studio | |
|---|---|---|---|
| Install | None, one file | Installer or script | Desktop installer |
| Interface | Terminal + simple web chat | CLI, API, desktop app | Full GUI |
| Model library | Pre-built files or any GGUF | ollama pull library | Built-in Hugging Face browser |
| Portability | Excellent (USB stick, offline PCs) | Good | Good |
| Best for | Sharing and offline use | Developers and servers | Beginners who want a GUI |
See our LM Studio vs Ollama comparison if you’re weighing the other two.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| “Developer cannot be verified” on Mac | Gatekeeper | Allow it under System Settings > Privacy & Security |
| Windows says it’s not a valid app | File over 4 GB or missing .exe | Rename to .exe; for big models use llamafile.exe -m model.gguf |
| Process killed instantly on Windows | Security software (the docs mention CrowdStrike) | Ask IT to whitelist llamafile |
| Linux tries to run it with WINE or run-detectors | binfmt_misc handlers | Install the APE loader and register it, as the troubleshooting page shows |
| Fails inside WSL | WSL interop grabs the file | Register APE with systemd, or disable interop in /etc/wsl.conf |
| Slow, GPU not used | No -ngl or old GPU |
Add -ngl 999; run with --verbose to check |
| Out of memory | Model or context too big | Use a smaller model or lower --ctx-size |
| Illegal instruction | CPU lacks AVX | x86-64 CPUs need AVX support |
FAQ
Is llamafile free?
Yes. It’s open source under Apache 2.0. Each model inside keeps its own license.
Who makes llamafile?
Mozilla. The project lives at github.com/mozilla-ai/llamafile.
Why won’t my llamafile run on Windows?
Make sure it ends in .exe and is under 4 GB. For larger models, run llamafile.exe with -m and a separate GGUF file.
What port does llamafile use?
8080 by default, with the OpenAI-compatible API at http://localhost:8080/v1.
Does llamafile use my GPU?
Apple Silicon GPUs are used automatically. On NVIDIA, add -ngl 999. AMD and Vulkan support exist but are less mature.
Can I use my own GGUF models?
Yes. Run the llamafile program with -m model.gguf.
Does llamafile work offline?
Yes. Once downloaded, everything runs locally with no internet connection.




