Run your first local model with Ollama
From nothing installed to a coding model you can chat with offline and call from your editor, on macOS, Windows, or Linux. No account, no API key, and no cost.
What you’ll learn
- Install Ollama on macOS, Windows, or Linux from a terminal.
- Choose a model size that fits your available RAM or VRAM.
- Pull a model and run it in an interactive terminal chat.
- Confirm the model keeps answering with the network disconnected, proving it runs fully offline.
- Connect an editor or an OpenAI SDK client to the local Ollama API.
- Manage installed models with ollama ls, ps, rm, and stop.
Ollama is the fastest way to get a real language model running entirely on your own machine, no cloud account and no data leaving your computer. This walks through installing it on macOS, Windows, and Linux, pulling a model sized to your hardware, chatting with it, proving to yourself that it is genuinely offline, and then wiring it into your editor over a local API.
1. Install Ollama
macOS and Linux install with the exact same one-line script. Windows uses a PowerShell equivalent. If you would rather click through an installer, download the .dmg or .exe directly instead.1
curl -fsSL https://ollama.com/install.sh | shirm https://ollama.com/install.ps1 | iexollama --version. It should print a version number.Once installed, Ollama runs quietly in the background and starts automatically on login, on macOS and Windows it registers as a login item, and on Linux it runs as a systemd service.2 There is nothing else to start before the next step.
2. Pick a model for your hardware
Ollama runs fine on CPU alone, but it is faster with a supported GPU: Nvidia cards with compute capability 5.0 or newer and a recent driver, AMD Radeon cards through ROCm on Linux and Windows, and Apple Silicon Macs automatically through Metal.3 Without one of those, Ollama quietly falls back to your CPU. It still works, just slower.
As a rough rule, a model needs about as much free RAM or VRAM as its download size, plus headroom for your OS and its context window. This guide uses qwen2.5-coder:7b, a 7-billion-parameter coding model that downloads at roughly 4.7 GB,4 so 8 GB of RAM is a safe minimum and 16 GB gives you room to try bigger models later. Smaller and larger sizes of the same model are in the library, and Which GGUF quantization level should you pick? covers exactly what each size level costs you in memory and quality.
In practice, ollama run also downloads a model automatically the first time you use it, so pulling first is not strictly required, it just separates the download from the first chat.5
3. Pull the model
Download the model once. After this it lives on disk and starts instantly.
ollama pull qwen2.5-coder:7bollama ls lists it as installed.4. Run it and chat
Start a chat right in your terminal.5
ollama run qwen2.5-coder:7b/bye to leave the chat.55. Confirm it is actually offline
This is the point of the whole exercise. Turn off Wi-Fi (or unplug ethernet), then send the same chat another prompt. It still answers, because the weights and the computation are entirely on your hardware.
One thing to watch for: some model names carry a :cloud tag, for example gemma4:cloud, and those run on Ollama cloud infrastructure instead of your machine, the exact same way any other cloud API does.6 Ollama is explicit that it only processes your prompts when you use a cloud-hosted model; anything run locally never leaves the machine.2 Stick to a plain tag, no :cloud suffix, if the goal is staying fully offline. For a fuller look at when local is the right call and when it is not, see the AI Foundations lesson on using AI well.
6. Use it from your editor
Ollama also runs an OpenAI-compatible API on http://localhost:11434/v1. Anything that lets you set a custom base URL and API key, an editor, an agent, or an SDK, can point at your local model instead of a cloud one. The API key is not checked; it just needs to be present.7
curl http://localhost:11434/v1/modelsfrom openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
reply = client.chat.completions.create(
model="qwen2.5-coder:7b",
messages=[{"role": "user", "content": "Say this is a test"}],
)
print(reply.choices[0].message.content)qwen2.5-coder:7b, and the Python snippet prints a reply. Any tool that accepts an OpenAI-style base URL works the same way.7Prefer a native client over the OpenAI-compatible shim? Ollama also ships official Python and JavaScript libraries that talk to its own API directly.5 Either route keeps every request, and every response, on your machine.
7. Manage your models
A handful of commands cover everything you need day to day.8
| Command | What it does |
|---|---|
| ollama pull <model> | Download a model, or fetch the latest version of one you already have |
| ollama ls | List every model currently on disk |
| ollama ps | Show what is loaded in memory right now, and whether it landed on CPU or GPU |
| ollama rm <model> | Delete a model and free the disk space |
| ollama stop <model> | Unload a model from memory without deleting it |
ollama ps reads 100% GPU, 100% CPU, or a split like 48%/52% CPU/GPU depending on how the model was loaded.2ollama create. The OLLAMA_HOST environment variable changes where the API server binds, useful if you want to reach it from another machine on your network instead of only localhost.Troubleshooting
- Out of memory, or a model will not load: the model needs more RAM or VRAM than is free. Run
ollama psto see whether it loaded onto CPU, GPU, or a split,2 close other memory-heavy apps, or switch to a smaller model or a lower quantization; see Which GGUF quantization level should you pick? for the exact memory and quality trade-off. - Generation is slow: check
ollama psfirst. A100% CPUload on a machine with a supported GPU usually means a driver problem, not a software one.2 Confirm your GPU meets the driver and compute-capability minimums,3 and check the logs for GPU discovery errors.9 A smaller model or a lower quantization also generates faster on the same hardware. - "model not found," or a pull/run fails: double-check the exact name and tag with
ollama ls;8 most models need an explicit size tag like:7b, and a bare name defaults to:latest. Confirm the name exists in the model library, then re-runollama pull.
You now have a model running entirely on your machine, reachable from your terminal and from your editor, with nothing going out over the network. From here, most of the work is picking the right model and the right size for what you have. Which GGUF quantization level should you pick? covers exactly that trade-off, and the free AI Foundations course covers the ideas behind local models, prompting, and agents if you want the fuller picture.
Sources
Verified against primary sources: August 2026.
- Download Ollama. Ollama (official). https://ollama.com/download
- FAQ. Ollama docs (official). https://docs.ollama.com/faq
- Hardware support (GPU). Ollama docs (official). https://docs.ollama.com/gpu
- Qwen2.5-Coder model page. Ollama (official). https://ollama.com/library/qwen2.5-coder
- README and quickstart. ollama/ollama, GitHub. https://github.com/ollama/ollama
- Quickstart. Ollama docs (official). https://docs.ollama.com/quickstart
- OpenAI compatibility. Ollama docs (official). https://docs.ollama.com/api/openai-compatibility
- CLI reference. Ollama docs (official). https://docs.ollama.com/cli
- Troubleshooting. Ollama docs (official). https://docs.ollama.com/troubleshooting