Skip to content
How-to Beginner 30 min read by Rajat Jain Updated August 13, 2026

How to Install and Use Ollama (2026 Guide)

From zero to running open models: install Ollama on macOS, Windows or Linux, pull and chat with your first model, and fix the errors everyone hits.

Note

Verified against the official Ollama documentation and the ollama/ollama GitHub repository, both fetched 13 August 2026. Commands reflect the current CLI (including `ollama ls` and `ollama stop`).

Before you start

  • A computer with at least 8GB of RAM (16GB makes models noticeably faster)
  • A terminal - Terminal.app, PowerShell, or any Linux shell
  • About 5GB of free disk for the first model (models grow from there)
Jump to section
  1. 1

    Install Ollama

    One command per OS - or a native installer if you prefer. macOS and Linux use the same install script; Windows uses PowerShell.

  2. 2

    Pull your first model

    `ollama run gemma4` downloads and starts a chat with Google's Gemma 4 in one shot. First run downloads ~4-9GB, so grab a coffee.

  3. 3

    Chat and test it

    Type prompts directly, use multiline input with three quotes, and check how the model loaded with `ollama ps`.

  4. 4

    Manage your model library

    `ollama ls` lists installed models, `ollama rm` deletes them, `ollama stop` unloads from memory. You'll switch models constantly - this is the muscle memory.

  5. 5

    Use it from code

    Ollama runs an API on port 11434 with an OpenAI-compatible endpoint at /v1 - your scripts, editors, and agent tools can point at it.

Ollama is the fastest path from “I have a laptop” to “I have local open-source models” - one installer, one command to pull a model, and an OpenAI-compatible API that every tool you own can talk to. This guide takes you from nothing to chatting with Gemma 4 in about ten minutes, then shows you the model-management and API skills that make Ollama the default local runtime in 2026.

Ollama is a free, open-source runtime (MIT license) that downloads models from its registry, keeps them on your disk, and runs them locally - no cloud account, no API key. It’s the engine our Open-Weight Models for Coding hub assumes everyone has, the directory entry covers it in one paragraph, and it’s the pair for Open WebUI if you want a chat interface on top.

The bigger picture

This guide is step zero of the local-AI stack. Once Ollama is running, the next moves are: run DeepSeek V4-Flash on multi-GPU hardware, put Open WebUI in front of it, or pick the right model for your job.

Step 1: Install Ollama

macOS / Linux - the official install script:

curl -fsSL https://ollama.com/install.sh | sh

Windows - PowerShell (run as a normal user; no admin needed):

irm https://ollama.com/install.ps1 | iex

Prefer installers? The official download page has native packages for macOS (Ollama.dmg) and Windows (OllamaSetup.exe).

Verify the install with a version check - you want a version number, not “command not found”:

ollama --version

On macOS and Windows, Ollama registers as a login item and the server keeps running in the background - that’s expected. On Linux, the script installs a systemd service.

Step 2: Pull your first model

The one command that does everything - downloads and starts a chat:

ollama run gemma4

What happens: Ollama downloads the model (a few GB on first run - this is the slow part), loads it, and drops you into a >>> prompt:

>>> 

Say hello. Yes, it’s really that simple. To leave the chat, type /bye or press Ctrl+D.

Your hardware decides the model

Gemma 4 is a safe default for almost any machine. For bigger tasks, our model chooser walks through the trade-offs - context size, VRAM, license - before you spend an hour downloading something that won’t fit.

Step 3: Chat like you mean it

Basic prompts work out of the box. Two power moves:

Multiline input - wrap text in three quotes:

>>> """
Explain the difference between supervised and unsupervised learning
to a smart 12-year-old. Keep it under 150 words.
... """

Ask about local files - multimodal models read image paths directly:

ollama run gemma4 "What's in this image? /Users/you/Desktop/screenshot.png"

See where the model is running - this tells you if you’re using your GPU:

ollama ps

Output shape (the PROCESSOR column is the key):

NAME      ID            SIZE    PROCESSOR   UNTIL
gemma4    bcfb190ca3a7  4.9 GB  100% GPU    4 minutes from now

100% GPU means full speed. 100% CPU works fine but slower. A split like 48%/52% CPU/GPU is partial offload - normal on smaller machines.

Step 4: Manage your model library

The daily commands, one look:

ollama ls          # list installed models
ollama pull qwen3:8b   # download without starting a chat
ollama run gemma4  # start (or switch to) a model
ollama stop gemma4 # unload from memory right now
ollama rm gemma4   # delete a model from disk

A few behaviors worth knowing:

  • Models stay loaded in memory for about 5 minutes after the last request, so back-to-back calls are fast. ollama stop unloads immediately; the API keep_alive parameter controls this precisely.
  • Pull a second model while the first is loaded and Ollama juggles memory - it queues requests and unloads idle models to make room. OLLAMA_MAX_LOADED_MODELS and OLLAMA_NUM_PARALLEL tune this for busy servers.
  • Models live on disk at: macOS ~/.ollama/models · Linux /usr/share/ollama/.ollama/models · Windows C:\Users\<you>\.ollama\models. Move them with the OLLAMA_MODELS environment variable.

Disk fills faster than you think

Models range from ~1GB to 160GB+. Before pulling a big one, check free space with df -h (macOS/Linux) and confirm the target location - a full disk mid-download is the most common way people abandon local AI.

Step 5: Use it from code

Ollama runs an HTTP API on port 11434. Native chat call:

curl http://localhost:11434/api/chat -d '{
  "model": "gemma4",
  "messages": [
    {"role": "user", "content": "Why is the sky blue?"}
  ],
  "stream": false
}'

And the OpenAI-compatible endpoint at /v1 - this is the one that matters, because any tool with a “custom base URL” setting (editors, agent frameworks, scripts) can point at it:

curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma4",
    "messages": [
      {"role": "user", "content": "Write a one-line bash alias that greets me."}
    ]
  }'

Python and JavaScript SDKs exist too (pip install ollama, npm i ollama), and the CLI can even launch ready-made integrations - ollama launch claude, ollama launch codex, ollama launch opencode - to point coding agents at your local models.

Already in our guides

This exact endpoint is how our DeepSeek V4-Flash guide serves a 284B model from two GPUs, and how any agent framework connects. If your tool speaks OpenAI protocol, it speaks Ollama.

How to verify it worked

Run this exact sequence:

ollama --version                    # 1. version prints
ollama ls                           # 2. gemma4 listed
ollama ps                           # 3. gemma4 loaded, PROCESSOR column visible
curl http://localhost:11434/api/tags  # 4. JSON with your model names
ollama run gemma4 "Say ok"          # 5. instant reply

If all five pass, Ollama is installed, connected, and API-ready.

Troubleshooting

1. “Failed to connect to localhost port 11434” / port already in use. Something else grabbed 11434, or the server isn’t running. On macOS/Windows, check the tray/menubar icon - the app may have quit. On Linux: systemctl status ollama and restart with sudo systemctl restart ollama. To move Ollama to another port, set OLLAMA_HOST (e.g. 127.0.0.1:11435) - the FAQ documents the per-OS ways to set environment variables.

2. ollama run <model> says the model was not found. Check the exact name in ollama ls / the model library. Registry names are precise - qwen3:8b, not qwen3 8b. If you’re pulling from Hugging Face, the tag is the full repo form (hf.co/unsloth/DeepSeek-V4-Flash-0731-GGUF:UD-Q3_K_M) - partial names 404.

3. Models run at CPU speed when you expected GPU. Ollama’s docs cover GPU discovery in depth: reboot, update drivers, and on Linux verify the container runtime with docker run --gpus all ubuntu nvidia-smi. NVIDIA: load the uvm driver (sudo nvidia-modprobe -u). AMD: Ollama bundles ROCm 7 libraries and needs a ROCm 7 kernel driver - older drivers make discovery hang and silently fall back to CPU. Check ollama ps after fixing.

4. Requests start queueing or return “server overloaded”. That’s the documented 503 behavior when the request queue is full (default max 512). If you’re running several parallel requests against one small model, raise OLLAMA_NUM_PARALLEL and OLLAMA_MAX_QUEUE, or give the model more context budget. If a huge model is thrashing, ollama stop it and use a smaller one.

5. Downloads are painfully slow or stall. The models are multi-GB files; the FAQ recommends a proxy via HTTPS_PROXY for restricted networks and notes WSL2 users should disable “Large Send Offload” on the vEthernet (WSL) adapter - a known Windows networking fix. Also confirm you have enough disk; a full disk aborts pulls.

6. Ollama worked on the GPU in Docker, then switched to CPU. A documented Docker-specific failure: disable systemd cgroup management in Docker by adding "exec-opts": ["native.cgroupdriver=cgroupfs"] to /etc/docker/daemon.json and restarting the daemon - GPU discovery stops failing afterward.

What’s next

You now have the standard local runtime. The natural progressions: add a chat UI with Open WebUI, learn which model fits which job, or go big with DeepSeek V4-Flash on real GPUs. And if you ever wonder whether your machine is being used right - ollama ps never lies.

Questions, answered first

Do I need a GPU to use Ollama?

No. Ollama runs on CPU-only machines - Apple Silicon, Intel Macs, and plain PCs all work, just slower. A GPU (NVIDIA, AMD, or Apple Silicon) loads models into VRAM and makes everything noticeably faster; `ollama ps` tells you which memory your model actually landed in.

Does Ollama send my prompts anywhere?

No. The official FAQ states Ollama runs locally and the company does not see your prompts or data when you run locally - and you can disable cloud features entirely with `OLLAMA_NO_CLOUD=1`. Data leaves your machine only if you use cloud-hosted models or web search features.

How is Ollama different from LM Studio or llama.cpp?

Ollama wraps llama.cpp under the hood (that's its official backend) and adds model management, an API, and one-command pulls. LM Studio is a GUI-first alternative with the same llama.cpp core. If you want a plain server process and maximum control, run llama.cpp directly - our DeepSeek V4-Flash guide shows both paths.

Where are my models stored, and can I move them?

macOS: `~/.ollama/models`. Linux (package install): `/usr/share/ollama/.ollama/models`. Windows: `C:\Users\<you>\.ollama\models`. Set the `OLLAMA_MODELS` environment variable to relocate them - on Linux with the standard installer, give the `ollama` user ownership of the new directory.

How do I expose Ollama to other machines on my network?

By default Ollama binds to 127.0.0.1:11434 - local only. Change the bind address with the `OLLAMA_HOST` environment variable (for example `0.0.0.0:11434`), set on Linux via `systemctl edit ollama.service` and on macOS via `launchctl setenv`. Only do this on trusted networks, since the API has no built-in authentication.

You did it

  • `ollama --version` prints a version number
  • `ollama run gemma4` responded to a real question
  • `ollama ps` shows the loaded model and whether it's on GPU or CPU
  • You pulled a second model and switched between them
  • `curl http://localhost:11434/api/tags` returns JSON listing your models
  • You know where your models live on disk
Official sources