← All articles
Guide

How to run AI models on your own computer with Ollama: a beginner's guide

A practical guide to Ollama from its official docs: hardware needs, installing on Mac, Windows and Linux, running a first model, context length, coding agents and privacy settings.

Cloud chatbots are convenient, but there are good reasons to run a language model on your own machine: your prompts never leave the computer, there is no per-message cost, and you can keep working without an internet connection. Ollama has become one of the most common ways to do that. It is a free app and command-line tool that downloads open models, runs them locally and exposes them to other apps through a local API.

This guide walks through what Ollama is, what hardware you need, how to install it on each operating system, how to pick and run a first model, and how to connect it to the coding agents and desktop apps you may already use. Everything here comes from Ollama's official documentation, which is linked throughout so you can check the current details. We have not benchmarked any hardware ourselves; where we mention sizes or memory needs, they are the figures Ollama publishes.

What Ollama does, and what it does not

At its core, Ollama is a local model server. Once it is running, it listens on your computer and answers requests from the command line, from its own desktop app, or from any program that calls its API. According to the API introduction, the local server listens on port 11434 of your own machine (localhost), and it speaks three dialects: Ollama's own API, an OpenAI-compatible API under /v1, and an Anthropic-compatible endpoint. That compatibility is the reason so many tools can plug into it with a one-line change of base URL.

Ollama also offers cloud models now. The quickstart describes two paths: sign in and use hosted cloud models, or choose a local model that runs entirely on your hardware. This guide focuses on the local path, since that is where the privacy and cost benefits come from. If you only want local use, the FAQ explains how to switch the cloud features off entirely (more on that below).

What Ollama does not do is make a small computer behave like a data center. Local models are limited by your memory, and the largest open models will not fit on a typical laptop. The trade-off is control: you decide which model runs, where the files live and who can reach the server.

Check your hardware first

The single most important number is memory, and specifically graphics memory (VRAM) on a PC or unified memory on an Apple silicon Mac. The quickstart's example model gives a sense of scale: it says the download for Gemma 4 E2B is about 7.2 GB, and recommends 8 GB of available VRAM or unified memory. It adds that larger context windows need more memory, and that Ollama can fall back on system RAM when VRAM runs short, at the cost of slower responses.

Platform requirements, according to Ollama's install pages:

  • macOS: the macOS page lists macOS Sonoma (v14) or newer. Apple M-series chips get both CPU and GPU support; older Intel Macs run on the CPU only.
  • Windows: the Windows page lists Windows 10 22H2 or newer, Home or Pro. NVIDIA cards need driver 551.61 or newer, and AMD Radeon cards are supported through ROCm or Vulkan drivers. The installer does not need administrator rights and wants at least 4GB of space for the program itself.
  • Linux: installation uses a script from Ollama, covered below.

Plan for disk space too. Both the macOS and Windows pages warn that models can be tens to hundreds of GB in size, so a laptop with a nearly full drive may need models stored elsewhere.

Install Ollama

On a Mac, download the app, mount the disk image and drag Ollama into the Applications folder, which the macOS page describes as the preferred method. On first launch the app checks that the ollama command is on your path and offers to add a link for it if not.

On Windows, run the installer. The Windows docs say Ollama then runs in the background, and the ollama command works in Command Prompt, PowerShell or any other terminal. Updates download automatically on both Mac and Windows; the FAQ says you apply them from the menu bar or taskbar icon with "Restart to update."

On Linux, the FAQ gives a one-line command that downloads and runs Ollama's install script from its website; re-running the same command upgrades an existing install. On Linux you may need to start the server yourself with ollama serve if it is not already running, the quickstart notes. As with any script you pipe into a shell, read it first if your security policy requires that.

Run your first model

With Ollama installed, one command downloads a model and opens a chat in the terminal. The quickstart uses a small Gemma model as its example:

ollama run gemma4:e2b

Type your questions at the prompt, and type /bye to leave. The first run takes a while because the model has to download; later runs start from the local copy.

A handful of other commands from the CLI reference cover most day-to-day needs:

  • ollama pull followed by a model name downloads it without starting a chat.
  • ollama ls lists the models you have downloaded.
  • ollama ps shows which models are loaded in memory right now.
  • ollama stop followed by a model name unloads it from memory.
  • ollama rm followed by a model name deletes it and frees the disk space.

For longer prompts, the CLI reference shows that you can wrap multi-line text in triple quotes. Vision-capable models can take an image path inside the prompt, and embedding models return a JSON array of numbers, which is useful if you are building search over your own documents.

Choosing a model

The right model depends on your memory more than anything else. A sensible approach is to start with a small model like the one above, confirm everything works, and then move up in size until responses get too slow. The examples in Ollama's own docs use open-weight families such as Google's Gemma, Alibaba's Qwen and Meta's LLaMA, and many models come in several sizes. Check a model's download size before pulling it: as a rough guide, it should fit comfortably within your available VRAM or unified memory, with room left for the context.

Is the model actually using your GPU?

A model that spills out of graphics memory still works, but much more slowly. The FAQ explains how to check: run ollama ps and look at the PROCESSOR column. 100% GPU means the model sits entirely in graphics memory, 100% CPU means it is running from system RAM, and a split between the two means it is partly offloaded. If you see a split, a smaller model or a shorter context will usually help.

Context length: the setting that matters for agents

Context length is how much text the model can keep in view at once: your prompt, the conversation so far and any files a tool passes in. Ollama's context length page says the default depends on your VRAM:

  • under 24 GiB: a 4k-token context;
  • 24 to 48 GiB: 32k;
  • 48 GiB or more: 256k.

The same page recommends at least 64000 tokens for tasks like web search, agents and coding tools, and warns that a larger context needs more memory. You can change it with a slider in the app's settings, or when starting the server:

OLLAMA_CONTEXT_LENGTH=64000 ollama serve

This is a common reason a local model seems to lose track of earlier parts of a long coding session. If an agent loses track of files it read a few minutes ago, check the context setting before blaming the model.

Connect Ollama to the tools you already use

Running a chat in the terminal is a good test, but most people want a local model inside their existing workflow. Ollama has a built-in launcher for this. According to the CLI reference, ollama launch sets up and starts supported integrations, which currently include Claude Code, OpenAI's Codex, OpenCode, VS Code and Factory's Droid. For example, from your project folder:

ollama launch claude

The quickstart says Ollama offers to install Claude Code if it is missing (Codex CLI needs to be installed first), and then asks you to choose a model. You can also name the model directly with a --model flag.

On macOS, the quickstart describes an Apps section in the Ollama app that connects the Claude and ChatGPT desktop apps. It notes that in ChatGPT Desktop, Ollama models are used in Codex mode, while regular chat and voice keep using your normal ChatGPT connection.

For your own scripts, the OpenAI-compatible endpoint means most existing client code works by pointing it at the /v1 path of your local Ollama server. The OpenAI compatibility page lists which features are supported, and the quickstart notes that the compatibility layers cover only a subset of the original APIs, so test anything beyond basic chat.

Privacy and network settings worth knowing

Privacy is the usual reason to run models locally, so it is worth knowing exactly what Ollama says about it. Its FAQ states that when you run locally, the company does not see your prompts or data. For cloud models, it says prompts and responses are processed to provide the service but are not stored, logged or used for training.

If you want to rule out cloud use altogether, the FAQ describes a local-only mode: set the disable_ollama_cloud option to true in ~/.ollama/server.json, or set the environment variable OLLAMA_NO_CLOUD=1, then restart Ollama. You lose cloud models and web search, and the logs confirm the setting.

Two network defaults are also worth understanding:

  • The server only listens on your own machine. The FAQ says Ollama binds to 127.0.0.1 on port 11434 by default. Changing OLLAMA_HOST exposes it to your network. Local requests do not need an API key, according to the API introduction, so do not expose the server beyond a network you trust without putting a proxy with authentication in front of it.
  • Browser access is limited. By default the FAQ says cross-origin requests are allowed only from 127.0.0.1 and 0.0.0.0. Browser extensions that want to talk to Ollama need their origins added through OLLAMA_ORIGINS.

Where your models live, and how to move them

Models are the bulk of Ollama's disk use. The FAQ lists the default locations: ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows. To store them on another drive, set the OLLAMA_MODELS environment variable and restart Ollama. On Windows, the install page notes that the uninstaller will not remove models you moved to a custom location, so delete those by hand if you want the space back.

Customizing a model

Once you are comfortable, you can create your own variants. The CLI reference shows the pattern: write a short Modelfile that names a base model and adds a system prompt, then build it with ollama create. The Modelfile reference documents the other settings you can bake in. This is a lightweight way to keep a code-reviewer or translator persona one command away, without retraining anything.

When local is the right choice

A local setup with Ollama makes most sense when:

  • you handle material you cannot paste into a cloud service, such as client contracts, private code or health records;
  • you want predictable costs for heavy, repetitive tasks like classification or summarization;
  • you need to keep working offline or on a restricted network;
  • you want to experiment with open models and agent tools without usage limits.

It makes less sense when you need the very strongest reasoning available, very long context on modest hardware, or zero setup. For those jobs a hosted assistant is usually the better fit, and many people end up using both: a local model for private or bulk work, and a cloud model for the hardest problems.

Quick start checklist

  1. Check that your Mac, Windows or Linux machine meets the requirements above, and that you have enough free disk space.
  2. Install Ollama and confirm ollama runs in a terminal.
  3. Run a small model with ollama run and check ollama ps shows it on the GPU.
  4. Raise the context length before using coding agents.
  5. Connect your tools with ollama launch, or point your scripts at the local /v1 endpoint.
  6. Turn on local-only mode if you never want cloud models, and leave the server bound to your own machine unless you have a reason to change it.

Ollama changes quickly, with new models and integrations arriving often, so treat the official docs linked above as the source of truth for exact commands and requirements.

More articles