New Tool Radar

Local AI

How to Run a Llamafile with External GGUF Weights

Download the llamafile program without weights, fetch a GGUF model file separately, and run it with the -m flag — including on Windows, where executables over 4 GB cannot run.

Schematic diagram with three steps: download the llamafile program without weights, fetch a GGUF model file, then run llamafile with the -m flag and chat at localhost 8080.

A llamafile is a single-file executable that contains a language model and the runtime that runs it. The llamafile project combines llama.cpp with Cosmopolitan Libc into one framework that collapses all the complexity of running a model down to a single file that runs locally on most operating systems and CPU architectures, with no installation. Most ready-made llamafiles have the weights built in — but you do not have to use llamafile that way. You can download just the llamafile program, without any weights, and run it alongside any external GGUF weights you have on hand.

Download the llamafile program alone

Each release on the llamafile releases page ships several independent single-file programs, and they are not bundled together inside the llamafile executable: if you want them all, choose the zip download; otherwise pick the one that matches the task. The file called llamafile runs LLMs for chat and completions, and it is the program the docs refer to throughout. There is also llamafile-thin, the same program without the pre-built GPU libraries appended, so it is the smaller download. The docs say to use llamafile unless you want the smallest download and only need CPU inference, you have an Apple Silicon Mac, or you have already set up your own GPU backend libraries.

The docs give this Windows example, downloading the program and a model file:

curl -L -o llamafile.exe https://huggingface.co/mozilla-ai/llamafile_0.10/resolve/main/llamafile_0.10.1
curl -L -o gpt-oss.gguf https://huggingface.co/unsloth/gpt-oss-20b-GGUF/resolve/main/gpt-oss-20b-Q5_K_S.gguf

On macOS, Linux, or BSD, download the llamafile file from the releases page and grant permission to execute it, the same way the README quick start does for a ready-made llamafile:

chmod +x llamafile

Download a GGUF model file

The model file is an ordinary GGUF file, downloaded separately from the program. The docs example above fetches gpt-oss-20b-Q5_K_S.gguf, the gpt-oss model, which the docs note is over 12 GB — far too large to ship inside a single Windows executable, which is exactly why the external-weights route exists. External weights are particularly useful for Windows users because they let you work around Windows’ 4 GB executable file size limit: the README says only executables under 4 GB can run on Windows, so any llamafile above 4 GB will not work there, and to download the llamafile binary and run it with any external GGUF weights instead.

Run it with -m and chat

Point the program at the weights file with the -m flag:

./llamafile.exe -m gpt-oss.gguf

Windows users may need to change ./llamafile.exe to .\llamafile.exe when running the command. On macOS, Linux, or BSD the same flag applies: ./llamafile -m gpt-oss.gguf. A chat interface opens in the terminal window, and you can start writing at once. When llamafile is running, you can also chat with it using llama.cpp’s Web UI: open a browser window and connect to http://localhost:8080/. When you are done chatting, press Control-C to shut down llamafile.

The same -m flag also works on a model you already downloaded with another app, as long as it is stored locally in GGUF format. LM Studio stores downloaded models in ~/.cache/lm-studio/models/lmstudio-community, in subdirectories named after the models, minus their quantization level. So if you have downloaded the gpt-oss-20b-MXFP4.gguf file, it is stored in ~/.cache/lm-studio/models/lmstudio-community/gpt-oss-20b-GGUF/, and you can run llamafile with it directly:

llamafile -m ~/.cache/lm-studio/models/lmstudio-community/gpt-oss-20b-GGUF/gpt-oss-20b-MXFP4.gguf

Try it: four checks from download to first reply

Check What you should see If you do not see it
Program downloaded The llamafile program file with no model weights inside it Check the releases page download finished, and pick the llamafile file
Weights downloaded A .gguf file such as gpt-oss.gguf in the same folder Run the GGUF download command again and check it finished
Server and chat start A chat prompt in the terminal and a server at http://localhost:8080 Check the -m flag names the GGUF file, then run the command again
First reply An answer to a question you type in the terminal chat or the browser Open http://localhost:8080 in your browser and try the web chat instead

Expected result. We checked the llamafile README on GitHub, which says a llamafile is a single-file executable with no installation, that only executables under 4 GB can run on Windows, and to download the llamafile binary and run it with external GGUF weights instead; and the Mozilla llamafile quickstart docs page on using llamafile with external weights, which gives the Windows download commands for the llamafile_0.10.1 program and the gpt-oss-20b-Q5_K_S.gguf file over 12 GB, the ./llamafile.exe -m gpt-oss.gguf command, the releases file table with llamafile and llamafile-thin, the LM Studio reuse path and command, and the terminal chat plus http://localhost:8080 web UI. We did not download or run llamafile or any GGUF file on this machine.

Limits

This guide covers running one GGUF file with the -m flag only. Building your own llamafile from a model file, and the separate whisperfile speech-to-text tool, are different jobs with their own docs pages. The llamafile-thin download has no pre-built GPU libraries bundled, so on most systems it needs a matching backend library on your machine to run on a GPU; the docs say to use the full llamafile file unless you only need CPU inference, have an Apple Silicon Mac, or have set up your own GPU libraries. The gpt-oss example is over 12 GB, so it needs that much disk space plus room to run. We did not run any of this ourselves.

Sources

See all