How to Run an LLM Locally
To run an LLM locally, you download an open model and run it on your own computer with a tool such as Ollama, LM Studio or llama.cpp. Once the model is on your machine, you can chat with it, call it from scripts through a local API, and use it without sending your prompts to a cloud service. A self-hosted LLM is the same idea on a machine you control, such as a home server or mini PC, that other devices on your network can use.
This guide covers which tool to start with, what hardware you need, and how to get a first answer. Commands and requirements come from the official docs, checked on 21 November 2026. Every real-world setup linked below is an entry already documented on this site, each with a link to its original source.
What "local" and "self-hosted" mean here
Local means the model runs on the computer you are sitting at. Self-hosted means it runs on a computer you control and other devices reach over your network. The same tools do both: Ollama, LM Studio and llama.cpp each include a server mode, so a laptop can answer for your phone, or a Mac mini can answer for your family.
Real self-hosted setups on this site include a Mac mini serving Open WebUI to a family of four, a Fedora homelab running llama.cpp's server as a systemd service, and a Tailscale-only private AI box. If you open a server to your network, read the hardening write-up first.
- A private ChatGPT for a family of four on a Mac mini
- A homelab llama-server on Fedora that runs as a systemd service and swaps models on demand
- NixNet: a Tailscale-only private AI box with Ollama, Open WebUI, Whisper and Piper on a 128 GB Minisforum
- Hardening a two-GPU Ollama server with systemd: 9.2 UNSAFE to 1.4
Pick a tool
Ollama is the quickest route if you are comfortable with a terminal. After you install it, one command downloads a model and starts a chat. It also runs a local server, so other software can use the model.
LM Studio is the quickest route if you prefer a window. You search for a model, download it and chat in the same app, and it can serve a local API when you want one. Its docs recommend choosing a 4-bit quantization or higher if your machine can handle it.
llama.cpp is the engine many tools are built on. Its README describes it as LLM inference in C/C++ with minimal setup, and it is MIT-licensed. It gives you the most control and the least hand-holding. If you are unsure, start with Ollama or LM Studio. For a side-by-side, read the comparison guide.
See also: Ollama examples · LM Studio examples · llama.cpp examples
Step-by-step: Ollama vs LM Studio: Which Should You Run Locally? →
What hardware you need
There is no single minimum, because it depends on the model. The official docs give some floors. LM Studio recommends 16 GB of RAM (8 GB Macs can run smaller models), at least 4 GB of dedicated VRAM on Windows, and a CPU with AVX2 on x64 Windows. Ollama needs macOS 14 or newer, Windows 10 22H2 or newer, or Linux, plus at least 4 GB of disk for the Windows install and tens to hundreds of GB for models.
To size a model, two measured rules from this site help. Kirill Lukyanov's working rule is that weights plus context should stay at or below three quarters of a Mac's RAM, and at 4-bit a model's weights take about 0.5 GB per billion parameters. Mikalai Karytka's starter guide says the model file plus about 20% should fit in your RAM or VRAM, giving roughly a 7 to 8B model at Q4 on 8 GB, 13 to 14B on 16 GB, and 27 to 34B on 32 GB.
Speed is mostly memory bandwidth. lowspecai measured about 9 GB/s on a 2011 NAS and showed that bandwidth divided by the weights read per token sets a ceiling of about 2 tokens per second for a 7B Q4 model on that box.
Real machines show the range. A Raspberry Pi 5 with 8 GB ran Phi-3 mini at 4 to 6 tokens per second, while 7 to 8B models ran under 2. A 200-euro mini PC ran Gemma 4 E4B at 5.5 tokens per second on CPU, and its owner called it fine for quick questions and too slow for daily work. A laptop with a 4 GB GPU kept 29 of 37 layers of a 4B model on the GPU. At the other end, an RTX 3090 ran GPT-OSS 20B at about 144 tokens per second on one prompt.
- How much RAM a local LLM needs on a Mac: measurements on a 16 GB MacBook M5
- Predicting local LLM speed on a 2011 NAS by measuring memory bandwidth in two seconds
- Offline LLM on a Raspberry Pi 5 for classification and extraction
- A €200 mini PC as an offline AI box: a week with Gemma and Qwen
- A 4B local model on a 4 GB laptop GPU as a PASS/FAIL test evaluator
- A private ChatGPT alternative on a six-year-old RTX 3090 with Ollama, Open WebUI and imported chat history
Your first chat
Ollama: install it from the download page, then run a model. The quickstart's example today is gemma4:e2b; browse the model library for others. Type /bye to leave.
# macOS or Linux, from ollama.com/download
curl -fsSL https://ollama.com/install.sh | sh
# Windows (PowerShell)
irm https://ollama.com/install.ps1 | iex
# then download a model and chat
ollama run gemma4:e2bDocs: Ollama download · Ollama quickstart
First chat with LM Studio or llama.cpp
LM Studio: download the installer for macOS, Windows or Linux, open the Discover tab (Cmd+2 on Mac, Ctrl+2 on Windows and Linux), search for a model, download a 4-bit or higher version, and chat. Its docs say LM Studio can run entirely offline once you have the model files.
To use LM Studio from scripts, start its server from the Developer tab or with the lms command line tool. Its OpenAI-compatible API then answers on the port shown in the app; the docs' examples use 1234.
llama.cpp: install it with one of the options in its README (an install script, Docker, pre-built binaries or a source build). The README's quick start then downloads a model from Hugging Face and chats, or serves an OpenAI-compatible API:
# from the llama.cpp README quick start
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUFDocs: LM Studio docs · LM Studio: download a model · llama.cpp README
- A copy-paste path to a local OpenAI-compatible LLM endpoint with LM Studio, Ollama, or llama.cpp
- Local AI: a one-click Windows app that picks a model for your PC and sets up Ollama for friends
- Local AI Starter: a one-click Mac wizard that installs llama.cpp, Qwen3, and OpenCode in one folder
Use it from your own tools
Once a model is running, most apps connect through an OpenAI-compatible URL. Ollama's local base URL is http://localhost:11434/v1/ (the client needs an API key value, but Ollama ignores it). That is how Open WebUI gives you a ChatGPT-style page in your browser, and how a coding tool like OpenCode talks to a local model.
Set the context window on purpose. An app that went through Ollama's OpenAI-compatible endpoint hit the default 4,096-token context and silently lost input until its authors set num_ctx.
- A one-script Ubuntu install that stands up Ollama and Open WebUI as a private ChatGPT in the browser
- OzAI: a self-hosted ChatGPT on a 16 GB MacBook with Ollama, LiteLLM and Open WebUI, and what broke
- OpenCode on a CPU-only Intel i7 laptop talking to local Ollama coder models
- Fixing silent tool-call failures caused by Ollama's 4,096-token default context
How is this different from ChatGPT?
A local model runs on your hardware, so you control the data, there is no per-token bill, and it works offline once downloaded. The trade-off is speed and capability: your hardware limits how large a model you can run. Karytka frames local models as best for private, high-volume or pinned-model work, with hosted models still better for the hardest reasoning. Gary Stow uses both: a local model at home for jobs it does cheaply, and a paid one for heavier coding.
Is it private?
Running locally keeps your prompts on your machine. Ollama's FAQ says it does not see your prompts or data when you run locally. Ollama also offers optional cloud models, and its docs say you can run local-only by setting OLLAMA_NO_CLOUD=1. Ollama binds to 127.0.0.1 by default, so other devices cannot reach it until you change OLLAMA_HOST.
LM Studio's docs say chatting with models, chatting with documents and running a local server all work without the internet, and that searching for and downloading models do need it.
See also: Privacy examples · Offline examples
What to do next
Once a model answers, pick a job. Each of these pages collects real setups with their sources.
See also: Local LLMs for writing · Ollama use cases · Ollama vs LM Studio · Local RAG on your notes and documents · Smart home · Voice · Homelab
FAQ
Can I run an LLM on my laptop? Yes. Small models run on ordinary laptops. This site documents a CPU-only laptop running Qwen2.5-Coder 1.5B and 7B models, and a laptop with a 4 GB GPU running a 4B model. Larger models need more RAM or VRAM; see the hardware section.
Is a GPU required? No. CPU-only setups work, but they are slower. The mini PC and Raspberry Pi examples above show what to expect.
Which tool should I start with? Ollama if you like a terminal, LM Studio if you like a window, llama.cpp if you want control.
How is this different from ChatGPT? See the section above: your hardware and data stay in your hands, but you are limited by your hardware.
What does self-hosted actually mean? It means the model runs on a machine you control, such as a home server, and other devices on your network use it, as in the Mac mini and homelab setups above.
Where do the facts come from? Official Ollama, LM Studio and llama.cpp docs, checked on 21 November 2026, plus the linked LocalUseCases entries. If something is not in those, this guide does not claim it.
Sources
Official pages used for commands and requirements.
Docs: Ollama quickstart · Ollama download · Ollama FAQ · Ollama API · Ollama Windows · Ollama macOS · LM Studio docs · LM Studio system requirements · LM Studio offline operation · LM Studio: download a model · llama.cpp README
More guides
- Local LLMs for Writing: 21 Real Private Setups
- Ollama use cases: 27 real local AI setups that work
- Ollama vs LM Studio: Which Should You Run Locally?
- Paperless-ngx auto tagging with Ollama: step-by-step
- Frigate Ollama setup: search camera footage in plain words
- MCP Use Cases: Practical Local AI Workflows