Skip to content
Table of contents9 sections · tap to jump
  1. What you need before you start
  2. Install Ollama on macOS, Windows or Linux
  3. Run your first local model
  4. Check whether Ollama is using your GPU
  5. List, stop and remove models
  6. Call the local API on port 11434
  7. Keep a model loaded between requests
  8. Common problems and how to fix them
  9. FAQ

Tutorialsoftware4 min read

How to run a local LLM on your own machine with Ollama

Ahmad JAug 13, 2026Updated Oct 23, 2026

Wooden and black electronic device with lens housing on wooden floor in home office

Install Ollama on macOS, Windows or Linux, run Gemma 4 or Llama 3.2 with one command, check it uses your GPU, and call the local API on port 11434.

Step-by-step: built to follow along.

Signalstrong9 independent sources

The short answer: to run a local LLM with Ollama, install Ollama (one command on macOS, Windows or Linux, or the app from ollama.com/download), then run ollama run gemma4:e2b in a terminal. Ollama downloads the model once, opens a chat on your computer, and serves the same model to your own programs at http://localhost:11434. Local models need no account and no API key. To run Llama locally, ollama run llama3.2 fetches Meta's 3B Llama 3.2, a 2.0 GB download. A GPU makes it faster but is optional: Ollama supports NVIDIA cards from compute capability 5.0, recent AMD Radeon cards and Apple's M-series chips, and it runs on the CPU when there is no supported GPU.

  1. Install Ollama for macOS, Windows or Linux.
  2. Run ollama run gemma4:e2b (or ollama run llama3.2) to download a model and start chatting.
  3. Type /bye to leave, then run ollama ps to see whether the model loaded on the GPU or the CPU.
  4. Call the model from code at http://localhost:11434/api/chat, or point an OpenAI client at http://localhost:11434/v1.

A local LLM is a language model that runs on your own hardware, so your prompts and its answers are processed on your machine. Ollama handles the fiddly parts: it downloads models from its library, loads them onto your GPU or CPU, and exposes them through a terminal chat and a local HTTP API. Ollama's FAQ says it does not see your prompts or data when you run locally. Ollama now also offers cloud models, whose tags end in cloud, such as gemma4:cloud or gemma4:31b-cloud; those run on Ollama's servers, so for a fully local setup use tags without that ending. This guide was checked against Ollama's documentation on October 23, 2026, when the latest release on GitHub was v0.40.10, published October 23, 2026. If you are still choosing a runner, our comparison of Ollama, LM Studio, vLLM and other local LLM runners covers the alternatives.

What you need before you start#

  • macOS: Sonoma (version 14) or newer. Apple M-series Macs get CPU and GPU support; Intel Macs run models on the CPU only.
  • Windows: Windows 10 22H2 or newer, Home or Pro. With an NVIDIA card, driver 551.61 or newer; with an AMD Radeon card, a ROCm v7 (HIP 7) capable driver, or a Vulkan-capable Radeon driver.
  • Linux: Ollama publishes packages for x86-64 (amd64) and ARM64. NVIDIA cards need driver 550 or newer; AMD cards need ROCm v7.
  • Disk: Ollama's Windows guide asks for at least 4 GB for the install itself, and warns that models "can be tens to hundreds of GB in size". Small ones are far lighter: Ollama's library lists gemma3:1b at 806 MB and llama3.2 at 2.0 GB.
  • Memory: for gemma4:e2b, Ollama's quickstart recommends 8 GB of available VRAM, or unified memory on a Mac. With less VRAM, Ollama can use system RAM, but responses may be slower. Our local LLM GPU checker shows which open models fit your card, and at which quantization.

Install Ollama on macOS, Windows or Linux#

Ollama's download page gives one install command per system. On macOS or Linux, in Terminal:

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

On Windows, in PowerShell:

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

If you prefer a normal installer, download Ollama.dmg on a Mac and drag Ollama into Applications, or run OllamaSetup.exe on Windows, which installs into your user account without administrator rights. On Windows the ollama command then works in cmd, PowerShell or any terminal, and Ollama keeps running in the background.

Check that the command line can reach the background server:

bash
ollama -v

If it prints ollama version is followed by a number, you are ready. If it prints "Warning: could not connect to a running Ollama instance", open the Ollama app (macOS or Windows) or start the server on Linux with ollama serve (or sudo systemctl start ollama if it was installed as a service), then try again. Running ollama on its own opens an interactive menu that offers to run a model or connect Ollama to tools such as Claude Code, Codex or OpenCode.

Run your first local model#

Models come from Ollama's library, much like container images: you pull one once, the weights are saved to disk, and later runs load from that copy. Ollama's own quickstart starts with Google's Gemma 4 E2B (the "E" stands for "effective" parameters, Google's label for its small edge models):

bash
ollama run gemma4:e2b

The first run downloads the model, then opens an interactive prompt. Type a question and the reply is generated on your machine. Wrap multi-line input in triple quotes ("""), and type /bye to leave.

The same command runs Meta's Llama models: ollama run llama3.2 pulls the 3B Llama 3.2, and ollama run llama3.2:1b the 1B version. Swap in any name from Ollama's library the same way.

Pick a model that fits your memory. These tags and sizes are as Ollama's library listed them on October 23, 2026; some tags list a range of sizes.

ModelCommandSize listed by OllamaNotes from the library
Gemma 3 1Bollama run gemma3:1b806 MBText only, 32K context window
Llama 3.2 3Bollama run llama3.22.0 GBText only, 128K context window
Qwen 3.5 4Bollama run qwen3.5:4b3.3 to 4.0 GBText and images, 256K context window
Gemma 4 E2Bollama run gemma4:e2b4.6 to 7.5 GBText and images, 128K context window; the quickstart's pick
Gemma 4 E4Bollama run gemma46.6 to 9.5 GBThe default gemma4 tag; text and images, 128K context window
Gemma 4 26Bollama run gemma4:26b16 to 19 GBMixture of experts with 4B active parameters, 256K context window

A rough rule for 4-bit models: plan on about one gigabyte of free memory per billion parameters. Hugging Face's GGUF documentation puts the common Q4_K format at 4.5 bits per weight, so the weights of an 8B model alone take about 4.5 GB (our arithmetic), and the context cache and runtime come on top. If your machine starts swapping, or replies crawl out a word at a time, drop to a smaller tag. Our What GPU do I need tool shows the smallest GPU or Mac for a given model and quantization, and How Much VRAM You Actually Need explains the sums.

Check whether Ollama is using your GPU#

Ask the model something, then run ollama ps. The PROCESSOR column shows where the model loaded: 100% GPU means entirely in GPU memory, 100% CPU means entirely in system memory, and a split such as 48%/52% CPU/GPU means part of it did not fit on the card. A CPU or split load is the first thing to check when a model feels slow.

What Ollama's hardware support page listed on October 23, 2026:

  • NVIDIA: compute capability 5.0 or newer with driver 550 or newer; cards at compute capability 5.0 to 6.2 need driver 570 or newer. Ollama's table runs from the GeForce GTX 750 and GTX 750 Ti to the RTX 50 series. Look up your card on NVIDIA's CUDA GPU compute capability page, and run nvidia-smi to confirm the driver works.
  • AMD on Linux: ROCm v7, for the Radeon RX 9000 and 7000 series, the RX 6800 and 6900 class, Radeon PRO and Radeon AI PRO cards, Ryzen AI chips such as the Ryzen AI Max+ 395, and Instinct accelerators.
  • AMD on Windows: ROCm v7 for the Radeon RX 7600, 7600 XT, 7700 XT, 7800 XT, 7900 GRE, 7900 XT and 7900 XTX, and the Radeon PRO W7500 to W7900. Other Radeon cards can use Vulkan, which Ollama enables by default.
  • Other GPUs, including Intel: Vulkan on Windows and Linux. Windows drivers usually include Vulkan; most Linux distributions need extra packages.
  • Apple: M-series Macs run models on the GPU through Metal, Apple's graphics and compute API.

If your card needs drivers first, our guide to setting up GPU drivers and the toolkit for local AI walks through NVIDIA and AMD.

List, stop and remove models#

A few commands keep your collection tidy:

bash
ollama list
ollama ps
ollama stop gemma4:e2b
ollama rm gemma4:e2b

ollama list (or ollama ls) lists the models on disk; ollama ps shows which are loaded in memory right now, and until when; ollama stop unloads a model without deleting it; ollama rm deletes its weights. To download a model without opening a chat, for example before a script needs it, use ollama pull gemma4:e2b.

Models are stored in ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows. To keep them on a bigger drive, set the OLLAMA_MODELS environment variable to another folder and restart Ollama.

Call the local API on port 11434#

While Ollama runs, it serves an HTTP API at http://localhost:11434. By default it listens only on 127.0.0.1, so only programs on your own computer can reach it, and local requests need no API key. A one-shot request:

bash
curl http://localhost:11434/api/generate -d '{
  "model": "gemma4:e2b",
  "prompt": "Explain a hash map in two sentences.",
  "stream": false
}'

The reply is one JSON object with the text in its response field. Streaming is the default: leave out "stream": false and the answer arrives as a series of JSON objects, one per line, as it is generated, which is what a chat interface wants. For a conversation, POST to /api/chat with a messages array; the answer is in message.content.

If your code already uses OpenAI's SDK, set its base URL to http://localhost:11434/v1. Ollama implements a subset of the OpenAI API there, including /v1/chat/completions, /v1/responses and /v1/embeddings; the client insists on an API key value, which Ollama ignores. There is also an Anthropic-compatible /v1/messages endpoint, and official Ollama libraries for Python and JavaScript.

Changing the listening address with the OLLAMA_HOST environment variable lets other computers reach the API, and with it anything else on that network. Read the security risks of running a local LLM before you do, and see Serve a local model as an API endpoint for a fuller setup.

Keep a model loaded between requests#

Ollama keeps a model in memory for 5 minutes after the last request, then unloads it, so the next call waits while the weights load again. To preload a model and choose how long it stays, send a request with only the model name and a keep_alive value:

bash
curl http://localhost:11434/api/generate -d '{"model": "gemma4:e2b", "keep_alive": "30m"}'

keep_alive takes a duration such as "30m" or "24h", a number of seconds such as 3600, any negative number such as -1 to keep the model loaded, or 0 to unload it as soon as the response is done. The OLLAMA_KEEP_ALIVE environment variable sets the same thing for every model when the server starts, and a keep_alive in a request overrides it. From the terminal, ollama run gemma4:e2b "" preloads a model and ollama stop gemma4:e2b unloads it. Run ollama ps to see what is loaded.

Common problems and how to fix them#

It is slow. Run ollama ps. If PROCESSOR shows CPU, or a CPU/GPU split, the model does not fit in your GPU memory: pick a smaller tag or a lower-bit quantization. Our explainer on memory bandwidth and local LLM speed covers what decides speed once it fits.

It runs out of memory in long chats. The footprint is not just the weights: the context window needs a key/value cache that grows with the context length. Ollama picks the default context from your VRAM (4K tokens under 24 GiB, 32K from 24 to 48 GiB, 256K at 48 GiB or more), and its docs suggest at least 64,000 tokens for agents, web search and coding tools. Raise it with OLLAMA_CONTEXT_LENGTH or the slider in the app's settings only if you have the memory. Setting OLLAMA_KV_CACHE_TYPE=q8_0 uses about half the cache memory of the default f16, with what Ollama's FAQ calls "a very small loss in precision"; it needs Flash Attention, which Ollama turns on automatically where the hardware supports it.

The GPU is not used. Check the driver first (nvidia-smi on NVIDIA). On Linux, after a suspend and resume Ollama can lose an NVIDIA GPU and fall back to the CPU; Ollama's docs suggest reloading the driver with sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm. The server log says what Ollama found: ~/.ollama/logs/server.log on macOS, journalctl -u ollama on Linux, and server.log in %LOCALAPPDATA%\Ollama on Windows.

Answers are weaker than you hoped. Small models score lower than big ones: in the Gemma 4 benchmark table on Ollama's library page, E2B scores 60.0% on MMLU Pro against 85.2% for the 31B model. Try a larger tag or a less aggressive quantization before giving up on a model; our guide to choosing a quantization for a local LLM explains labels such as Q4_K_M and Q8_0.

A model tag ends in cloud. Tags such as gemma4:cloud and gemma4:31b-cloud run on Ollama's servers, not on your machine, and need you to sign in. To keep Ollama local only, set OLLAMA_NO_CLOUD=1, or "disable_ollama_cloud": true in ~/.ollama/server.json, and restart Ollama. That also turns off its web search.

Frequently asked questions

Can I run a local LLM with Ollama offline?

Yes, once the model is downloaded. You need an internet connection to install Ollama and to pull a model; after that a local model runs from the copy on your disk. Ollama's FAQ says it does not see your prompts or data when you run locally. Models whose tags end in cloud, such as gemma4:cloud or gemma4:31b-cloud, are the exception, since they run on Ollama's servers. Ollama has a setting that switches cloud models off; the exact setting is in the Common problems and how to fix them section above.

What are the minimum requirements to run a local LLM with Ollama?

macOS Sonoma (14) or newer, Windows 10 22H2 or newer, or Linux on x86-64 or ARM64, plus disk space for the models and enough memory for the one you pick. For gemma4:e2b, Ollama's quickstart recommends 8 GB of available VRAM or Mac unified memory. Smaller models such as gemma3:1b (806 MB) or llama3.2 (2.0 GB) need far less. A GPU is optional; without one Ollama runs on the CPU, more slowly.

How do I install Ollama and run my first model?

On macOS or Linux run curl -fsSL https://ollama.com/install.sh | sh; on Windows run irm https://ollama.com/install.ps1 | iex in PowerShell, or use the installer from ollama.com/download. Then run ollama run gemma4:e2b, which downloads the model on first use and opens a chat. Type /bye to leave.

How do I run Llama locally with Ollama?

Install Ollama, then run ollama run llama3.2 for Meta's 3B Llama 3.2 (2.0 GB in Ollama's library) or ollama run llama3.2:1b for the 1B version (1.3 GB). The model downloads once and then runs on your machine.

Which GPUs does Ollama support?

NVIDIA GPUs with compute capability 5.0 or newer and driver 550 or newer (570 or newer for compute capability 5.0 to 6.2); AMD Radeon cards through ROCm v7 on Linux and, for the Radeon RX 7600 to 7900 XTX cards Ollama lists and the Radeon PRO W7500 to W7900, on Windows; other GPUs, including Intel, through Vulkan; and Apple M-series Macs through Metal. Run ollama ps after a prompt: 100% GPU means the model is on the card.

How much memory does a local model need?

As a rough rule, a 4-bit model wants about one gigabyte of free memory per billion parameters, counting the weights, the context cache and the runtime. A 3B model needs a few gigabytes, an 8B model closer to 8 GB, and longer conversations need more, because the context is held in memory too. If the machine swaps or replies crawl, drop to a smaller size.

How do I call Ollama from my own programs?

Ollama serves an API on port 11434. POST to http://localhost:11434/api/generate with a model and prompt for one-shot text, or to /api/chat with a messages array for a conversation. Responses stream by default; send "stream": false for a single JSON reply. For OpenAI client code, set the base URL to http://localhost:11434/v1; the client needs an API key value, which Ollama ignores.

How do I stop the model reloading on every request?

Ollama unloads a model 5 minutes after the last request by default. To keep it longer, send a keep-alive value with your request: a duration such as 30m, -1 to keep the model loaded, or 0 to unload it at once. The exact field name, and the environment variable that sets the default for every model, are in the Keep a model loaded between requests section above. Run ollama ps to see what is loaded.

Can I run Ollama in Docker?

Yes. For CPU only, run docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama. For an NVIDIA GPU on Linux, install NVIDIA's Container Toolkit, configure Docker with sudo nvidia-ctk runtime configure --runtime=docker, restart Docker, and add --gpus=all to the same command. Ollama's FAQ says GPU acceleration is not available for Docker Desktop on macOS.

Sources

  1. Ollama, documentationdocs.ollama.com
  2. Ollama, FAQ (models, memory and configuration)docs.ollama.com
  3. Hugging Face, GGUF quantization typeshuggingface.co
  4. llama.cpp, LLM inference in C/C++ (project repository)github.com
  5. Ollama, Quickstartdocs.ollama.com
  6. Ollama, CLI referencedocs.ollama.com
  7. Ollama, download page (install commands for macOS, Linux and Windows)ollama.com
  8. Ollama, GitHub repository READMEgithub.com
  9. Ollama, GitHub release v0.40.10 (Oct 23, 2026, marked Latest)github.com
  10. Ollama, CLI source at v0.40.10 (cmd/cmd.go)github.com
  11. Ollama, macOSdocs.ollama.com
  12. Ollama, Windowsdocs.ollama.com
  13. Ollama, Linuxdocs.ollama.com
  14. Ollama, Hardware supportdocs.ollama.com
  15. Ollama, Context lengthdocs.ollama.com
  16. Ollama, API introductiondocs.ollama.com
  17. Ollama, API: generate a responsedocs.ollama.com
  18. Ollama, API: streamingdocs.ollama.com
  19. Ollama, API: chatdocs.ollama.com
  20. Ollama, OpenAI compatibilitydocs.ollama.com
  21. Ollama, Troubleshootingdocs.ollama.com
  22. Ollama, Dockerdocs.ollama.com
  23. Ollama library: gemma4ollama.com
  24. Ollama library: gemma4 tagsollama.com
  25. Ollama library: gemma3ollama.com
  26. Ollama library: llama3.2ollama.com
  27. Ollama library: qwen3.5ollama.com
  28. Google AI for Developers: Gemma 4 model overviewai.google.dev
  29. NVIDIA: CUDA GPU compute capabilitydeveloper.nvidia.com
  30. NVIDIA: Container Toolkit installation guidedocs.nvidia.com
  31. AMD ROCm documentation: quick start installation guide (Linux)rocm.docs.amd.com
  32. Apple Developer: Metaldeveloper.apple.com

Ask about this article

Answered only from this piece. The AI never invents.

React
ShareXLinkedInBluesky

More in software

More in software

Discussion