Run models locally
Install and check Ollama
Install Ollama, verify the local service, and distinguish a missing runtime from a missing model.
Download Ollama for macOS, Windows, or Linux from the official site and install it.
Open a terminal and check the installed version:
ollama --version
You should see a version string, not “command not found”. That confirms the CLI is on your PATH.
Then ask the local API which models are available:
curl http://localhost:11434/api/tags
A JSON response means the service is reachable. An empty models array is fine. It means the runtime works but you have not pulled a model yet. You might see something like:
{"models":[]}
A connection error means the service is not listening. Start the Ollama application or service before changing application code. On macOS, open the Ollama app from Applications and wait until the menu bar icon appears.
This small health check gives us two separate facts:
runtime reachable?
requested model installed?
Keep those checks separate in a real application. “AI unavailable” is harder to diagnose than “Ollama is not running” or “gemma3:1b is not installed.”
I add a startup probe in apps that depend on local inference. One fetch to /api/tags with a short timeout tells the UI whether to show “start Ollama” instead of a vague error after the user clicks Summarize.
If curl fails with “Connection refused”, fix the runtime first. If curl succeeds but your model call fails with “model not found”, run ollama pull for the tag you configured. Mixing those two failures creates useless bug reports.
On Linux, if the app is installed but the daemon is not running, start it with your package manager or systemd unit, then rerun curl. The troubleshooting page lists platform-specific service names.
Try this on your own machine now: run both commands and note which case you are in before the next lesson.
Lesson completed