AI BirdView

How to Run AI Locally with Ollama: A Step-by-Step Tutorial for Mac, Windows and Linux (2026)

A plain-English Ollama tutorial: install it on Mac, Windows or Linux, pick a model that fits your RAM, chat in the terminal or app, call the local API, add Open WebUI, and know when Ollama's cloud models or LM Studio make more sense.

AI BirdView Editorial Team··9 min read
How to Run AI Locally with Ollama: A Step-by-Step Tutorial for Mac, Windows and Linux (2026)

To run an LLM locally, install Ollama from ollama.com, open a terminal and type "ollama run gemma4:e2b". Ollama downloads the model and starts a chat on your own computer, with no account, no fees and nothing sent to the cloud. A laptop with 8GB of RAM can run small models; 16GB runs gpt-oss-20b; 32GB runs 27-31B models that handle coding help and long documents.

What is Ollama? Ollama is a free app that downloads open-weight AI models and runs them on your Mac, Windows or Linux machine. It has a command line, a desktop chat app, and a local API that other apps can call. Every command here comes from Ollama's and Open WebUI's official docs, checked on December 1, 2026; we did not benchmark speeds.

What you need

  • A Mac on macOS Sonoma (14) or newer. Apple silicon (M-series) uses the GPU; Intel Macs run on the CPU only, which is slow.

  • Or a Windows PC on Windows 10 22H2 or newer. An NVIDIA GPU (driver 550 or newer) or a recent AMD Radeon card speeds things up a lot.

  • Or Linux with an NVIDIA, AMD or Vulkan-capable GPU, or just a CPU.

  • Memory: 8GB minimum, 16GB recommended, 32GB for mid-size models. On a PC, GPU VRAM matters most; on a Mac, total unified memory does.

  • Disk space: 2-20GB per model.

Step-by-step: run your first local model

Step 1: Install Ollama

  • Mac: download Ollama.dmg from ollama.com/download/mac and drag it into Applications. Open it once so it starts in the background.

  • Windows: download and run OllamaSetup.exe from ollama.com/download. It doesn't need admin rights. PowerShell fans can run: irm https://ollama.com/install.ps1 | iex

  • Linux: run this one line: curl -fsSL https://ollama.com/install.sh | sh

On Mac and Windows you also get the Ollama desktop app, a chat window where you pick a model from a menu, drop in PDFs or images, and change settings without the terminal.

Step 2: Run your first model

Open Terminal (Mac), PowerShell (Windows) or a shell (Linux) and type:

ollama run gemma4:e2b

Ollama downloads Google's Gemma 4 E2B (a few GB) and opens a chat prompt. Type a question and press Enter. Type /bye to exit. The model stays loaded for 5 minutes after your last message, then frees the memory.

Step 3: Pick a model that fits your RAM

The model's download size is a good guide to the memory it needs; leave a few GB spare for the operating system and context. These are current tags in Ollama's library:

Your RAM or VRAMTry thisDownloadGood for
8GBgemma4:e2b, qwen3.5:4b, llama3.2:3b2-7.5GBSummaries, rewriting, simple Q&A
16GBgpt-oss:20b, qwen3.5:9b, gemma4:12b6.6-14GBReasoning, writing, light coding
24-32GBqwen3.5:27b, gemma4:26b, gemma4:31b16-20GBCoding help, long documents, images
64GB+gpt-oss:120b65GBNear-frontier answers at home

OpenAI says gpt-oss-20b runs in as little as 16GB of memory. If replies crawl at a word per second, the model is spilling out of GPU memory: drop to a smaller size. Our best open source AI models guide explains which models are strongest and how their licenses differ.

Step 4: Learn the five commands you'll use

  • ollama pull qwen3.5:9b downloads a model without starting a chat.

  • ollama ls lists the models you've downloaded.

  • ollama ps shows what's loaded right now, how much memory it uses, and its context length.

  • ollama stop gemma4:e2b unloads a model to free memory.

  • ollama rm gemma4:e2b deletes a model from disk.

Models are stored in ~/.ollama/models on Mac, C:\Users\<you>\.ollama\models on Windows and /usr/share/ollama/.ollama/models on Linux. Set the OLLAMA_MODELS environment variable to move them to another drive.

Step 5: Raise the context length for long documents

Context length is how much text the model can consider at once. Ollama sets it by your GPU memory: 4K tokens under 24GB of VRAM, 32K at 24-48GB, and 256K above that. 4K is only a few pages, so for long files or coding, raise it.

  • In the app: drag the context length slider in Settings.

  • In the terminal: start the server with OLLAMA_CONTEXT_LENGTH=64000 ollama serve. Ollama recommends at least 64,000 tokens for agents and coding tools.

  • Check it: run ollama ps and read the CONTEXT column.

More context uses more memory, so a model that fit at 4K may slow down at 64K.

Step 6: Call the local API

Ollama runs a server at http://localhost:11434 that any app or script on your computer can use. Its native chat endpoint is /api/chat:

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

It also speaks the OpenAI format at http://localhost:11434/v1, so most tools built for OpenAI work by changing the base URL. Ollama's docs give this example:

curl -X POST http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "gpt-oss:20b", "messages": [{"role": "user", "content": "Say this is a test"}]}'

There's an Anthropic-compatible endpoint too, which lets Claude Code use local models. The new ollama launch command sets up coding tools such as OpenCode, Claude Code, Codex and VS Code against an Ollama model in one step. See how to use Claude Code for the tool itself.

Step 7: Add a ChatGPT-style interface with Open WebUI

The Ollama app covers basic chat. For multiple users, document chat, saved prompts and a browser interface, add Open WebUI. With Docker installed and Ollama running, the docs' command is:

docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data -e WEBUI_SECRET_KEY=your-secret-key --name open-webui --restart always ghcr.io/open-webui/open-webui:main

  1. Replace your-secret-key with a random string (openssl rand -hex 32 makes one).

  2. Open http://localhost:3000 in your browser.

  3. Create an account. The first account becomes the admin.

  4. Open WebUI finds Ollama automatically; pick a model at the top of the chat.

No Docker? Run python -m pip install open-webui and then open-webui serve, using Python 3.11 or 3.12, and open http://localhost:8080. Note that since version 0.6.6 Open WebUI's license restricts removing its branding for deployments above 50 users unless you buy an enterprise license.

Step 8 (optional): Use Ollama's cloud models for bigger jobs

Some open models, such as Kimi K3.1 Pro and DeepSeek V4.1 Flash, are far too big for a PC. Ollama can run them on its servers with the same commands. Run ollama signin, then a cloud tag such as ollama run gemma4:cloud. Nothing downloads.

Ollama planPriceIncludes
Local useFreeUnlimited, on your own hardware
Pay as you go$0 a monthPay per token, 3 concurrent requests
Pro$20/mo or $200/yr$60 of cloud usage a month, larger models
Max$100/mo$300 of usage a month, 10 concurrent requests
Team$500/mo (early access)$1,000 of shared usage a month

Ollama says cloud prompts and responses are never logged or trained on, and it runs a zero data retention policy. Still, cloud means your text leaves your machine. To block cloud models entirely, set OLLAMA_NO_CLOUD=1.

Common mistakes

  • Picking a model bigger than your memory. It will run, but painfully slowly. Start small and size up.

  • Leaving context at 4K and wondering why it forgets. Long PDFs and code need 32K-64K.

  • Exposing Ollama to your network by accident. It listens only on 127.0.0.1 by default. Setting OLLAMA_HOST=0.0.0.0 lets other devices on your network reach it with no password, so only do that on a trusted network.

  • Expecting ChatGPT quality from a 3B model. Small models are for drafting, summaries and private notes, not hard reasoning.

  • Using a cloud tag and thinking it's local. Anything ending in :cloud runs on Ollama's servers.

  • Forgetting the license. Most models are Apache 2.0 or MIT, but some have custom terms for commercial use.

Ollama vs LM Studio, Jan and Msty

ToolBest forPriceStandout
OllamaDevelopers and scriptsFree locally; cloud from pay-as-you-go, Pro $20/moSimple CLI, OpenAI- and Anthropic-compatible API
LM StudioPoint-and-click on MacFree for home and work; hosted models from $20/moMLX engine for Apple silicon, model browser
JanOpen-source desktop chatFree, Apache 2.0Local models plus cloud APIs, MCP support
MstyPower users comparing modelsFree; Aurum $149/yr or $349 lifetimeSplit chats and knowledge stacks

Choose Ollama if you want a background service other apps can call. Choose LM Studio if you'd rather browse and download models in a polished app, especially on a Mac. Choose Jan for a fully open-source ChatGPT-style app, and Msty to compare local and online models side by side.

FAQ

What is Ollama used for?

Ollama is used to download and run open AI models such as Gemma 4, Qwen 3.5 and gpt-oss on your own computer. It gives you a chat in the terminal or app and a local API that apps and coding tools can use.

Is Ollama free?

Yes. Running models on your own hardware is free and unlimited. Only the optional cloud models cost money, from pay-as-you-go to Pro at $20 a month.

Is Ollama private?

Local models are private: Ollama says it doesn't see your prompts or data when you run locally. Cloud models send text to Ollama's servers, which it says are not logged or used for training.

What is the best model to run in Ollama?

gpt-oss:20b is the best all-rounder for 16GB of RAM, gemma4:e4b or qwen3.5:4b for 8GB, and qwen3.5:27b or gemma4:31b for 32GB. Pick the largest model that fits comfortably in your memory.

Can Ollama run without a GPU?

Yes, it runs on the CPU, but slowly. Small models (1-4B) are usable on a CPU; anything larger really wants a GPU or Apple silicon.

Does Ollama work on Windows?

Yes. Install OllamaSetup.exe on Windows 10 22H2 or newer. It supports NVIDIA and AMD GPUs and includes the desktop chat app.

Is Ollama better than LM Studio?

Neither is better overall. Ollama is better for developers, scripts and coding tools; LM Studio is easier for browsing models and adds Apple's MLX engine on Macs.

Bottom line

Running AI locally takes about ten minutes: install Ollama, run a model that fits your RAM, raise the context length for real work, and add Open WebUI if you want a full chat interface. Keep everything local for private data, and reach for Ollama's cloud tags only when you need a model your computer can't hold.


Browse more local and open-model apps in the AI chat category and developer tools in the AI code category. Built a local AI tool we missed? Submit it for a listing.