Ollama downloads open-weight models and runs them locally. Your prompts never leave your machine, and it works offline once a model is downloaded.
Install Ollama
curl -fsSL https://ollama.com/install.sh | shirm https://ollama.com/install.ps1 | iexNothing to run on for this part.
Prefer a regular installer? Download
Ollama.dmg(macOS) orOllamaSetup.exe(Windows) from ollama.com/download. Piping a script into a shell runs it straight away, so if you want to check it first, open the URL in your browser and read it.
Check that it’s installed and running
ollama -vollama version is 0.x.x# On Linux the installer sets up a systemd service
sudo systemctl status ollamaNothing to run on for this part.
On macOS and Windows, Ollama runs as a menu-bar/tray app. If ollama says it can’t connect, start the app (or run ollama serve in another terminal).
Chat with a model
The first run downloads the model, which can take a few minutes.
ollama run gemma4pulling manifest
pulling 4f5e...: 100% ▕████████████████▏
success
>>> Send a message (/? for help)Nothing to run on for this part.
Type a question and press Enter. Type /bye to exit.
Manage your models
ollama ls # models you've downloaded
ollama ps # models loaded in memory right now
ollama stop gemma4 # unload a model from memory
ollama pull gemma4 # download or update without chatting
ollama rm gemma4 # delete a model to free disk spaceNothing to run on for this part.
Call the model from code (REST API)
Ollama serves an API on http://localhost:11434. "stream": false returns one JSON reply instead of a stream of chunks.
curl http://localhost:11434/api/chat -d '{
"model": "gemma4",
"messages": [{ "role": "user", "content": "Why is the sky blue?" }],
"stream": false
}'$body = @{
model = "gemma4"
messages = @(@{ role = "user"; content = "Why is the sky blue?" })
stream = $false
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Uri http://localhost:11434/api/chat -Method Post -ContentType "application/json" -Body $body{"model":"gemma4","created_at":"...","message":{"role":"assistant","content":"The sky looks blue because..."},"done":true,...}Nothing to run on for this part.
Troubleshooting
ollama says it can’t connect to the server: on Linux run sudo systemctl start ollama. On macOS/Windows open the Ollama app.
Very slow answers: the model may be too big for your RAM/GPU. Try a smaller variant (many models have tags like :2b or :4b on ollama.com/library), and check ollama ps to see whether it’s running on GPU or CPU.
Update Ollama: on Linux, run the install command from step 1 again. On macOS/Windows, the app updates itself.
Clean up
# Stop and disable the service (Linux)
sudo systemctl stop ollama
sudo systemctl disable ollama# Quit Ollama from the menu bar / system tray, then remove models you don't need:
ollama rm gemma4Nothing to run on for this part.
Sources
Commands checked against these official sources on 4 Nov 2026. Found something out of date? Open an issue.