Skip to main content
How-to Running local AI

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.

7 steps14 min readLast verified August 2026

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.

New to this? A local model is not a website or a hosted service, it is a file you download once that then runs entirely on your own computer. "Terminal" just means the text-based command window, Terminal on macOS/Linux, PowerShell on Windows, where you will type the commands below. No coding background is needed to follow this guide end to end.
Before you start: a Mac running macOS 14 (Sonoma) or later, a Windows PC, or a Linux machine;1 5 to 10 GB of free disk space depending on the model you pick; a terminal (Terminal on macOS/Linux, PowerShell on Windows). No account or payment method is needed for anything in this guide; an Ollama account only matters if you push your own models, pull private ones, or opt into Ollama cloud-hosted models.2

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

Install on macOS or Linux
curl -fsSL https://ollama.com/install.sh | sh
Install on Windows (PowerShell)
irm https://ollama.com/install.ps1 | iex
Check: open a new terminal window and run ollama --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.

Pull the model
ollama pull qwen2.5-coder:7b
Check: a one-time download of about 4.7 GB, then ollama ls lists it as installed.

4. Run it and chat

Start a chat right in your terminal.5

Run the model
ollama run qwen2.5-coder:7b
Check: you land on a prompt; type a question and a reply streams back. Type /bye to leave the chat.5

5. 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.

Check: a complete reply comes back with the network disconnected.

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

Confirm the API is up
curl http://localhost:11434/v1/models
Point an OpenAI SDK client at your local model
from 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)
Check: the curl call returns JSON listing qwen2.5-coder:7b, and the Python snippet prints a reply. Any tool that accepts an OpenAI-style base URL works the same way.7

Prefer 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

CommandWhat it does
ollama pull <model>Download a model, or fetch the latest version of one you already have
ollama lsList every model currently on disk
ollama psShow 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
Check: the PROCESSOR column of ollama ps reads 100% GPU, 100% CPU, or a split like 48%/52% CPU/GPU depending on how the model was loaded.2
Going further: Ollama can be customized with a Modelfile, a plain text file that sets a custom system prompt, temperature, or context length on top of a model, then built with ollama 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 ps to 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 ps first. A 100% CPU load 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-run ollama 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.

  1. Download Ollama. Ollama (official). https://ollama.com/download
  2. FAQ. Ollama docs (official). https://docs.ollama.com/faq
  3. Hardware support (GPU). Ollama docs (official). https://docs.ollama.com/gpu
  4. Qwen2.5-Coder model page. Ollama (official). https://ollama.com/library/qwen2.5-coder
  5. README and quickstart. ollama/ollama, GitHub. https://github.com/ollama/ollama
  6. Quickstart. Ollama docs (official). https://docs.ollama.com/quickstart
  7. OpenAI compatibility. Ollama docs (official). https://docs.ollama.com/api/openai-compatibility
  8. CLI reference. Ollama docs (official). https://docs.ollama.com/cli
  9. Troubleshooting. Ollama docs (official). https://docs.ollama.com/troubleshooting
Read nextWhich GGUF quantization level should you pick?