You want to try local AI but the setup seems complicated. Model files, quantization, runtimes, command-line tools — where do you even start?
Ollama makes this simple. It is a single application that downloads, manages, and runs AI models on your computer. Think of it as "Docker for AI models" — pull a model, run it, chat with it. That is it.
What Is Ollama?
Ollama is a lightweight, open-source tool that lets you run large language models (LLMs) locally on your computer. It handles everything: downloading models, loading them into memory, managing GPU acceleration, and providing an API for your applications.
👤 You → 🖥️ Ollama (localhost:11434) → 🧠 Model → ⚡ CPU/GPU → 💬 Response
│
↓
🔒 Everything stays on your PC
Why Use Ollama?
| Feature | Ollama | Manual Setup |
|---|---|---|
| Installation | One installer | Compile from source, install dependencies |
| Model download | ollama pull model | Find model, download, convert format |
| Model management | Automatic | Manual file management |
| GPU detection | Automatic | Manual configuration |
| API | Built-in REST API | Build your own |
| Updates | One command | Manual rebuild |
Supported Operating Systems
| OS | Status | Notes |
|---|---|---|
| macOS | ✅ Supported | Apple Silicon (M1-M4) has native acceleration |
| Linux | ✅ Supported | NVIDIA GPU acceleration on most distros |
| Windows | ✅ Supported | NVIDIA GPU acceleration, WSL2 recommended |
Installation
macOS
Or with Homebrew:
brew install ollama
Linux
curl -fsSL https://ollama.com/install.sh | sh
Windows
Run the .exe installer and follow the prompts.
Verify Installation
Downloading a Model
phi3:mini (2.2 GB) if you have limited RAM or want the fastest download. It handles basic tasks well. Upgrade to llama3.1:8b when you want better quality.
Running a Model
Model Management
Model Storage
Downloaded models are stored in:
| OS | Default Location |
|---|---|
| macOS | ~/.ollama/models/ |
| Linux | ~/.ollama/models/ |
| Windows | %USERPROFILE%\.ollama\models\ |
Models are stored in GGUF format (quantized). The actual disk usage depends on the quantization level.
📖 Read more: GGUF Explained: The Practical Guide to Local LLM Model FilesConfiguration
Environment Variables
Context Settings
Context length affects how much text the model can process. You can override it per request:
API Usage
Ollama runs a local API server at http://localhost:11434. Every chat message you send in the terminal uses this API.
Generate Completion
Chat Completion
Python Integration
The demo below shows a complete Python client for Ollama. It works with the real API when Ollama is running, and falls back to mock responses when it is not.
demo.py and run python demo.py to see the full Ollama integration in action. Run python demo.py --test to verify all 15 test cases.
First 10 Things to Try
| # | Try This | What You Learn |
|---|---|---|
| 1 | ollama run phi3:mini | Basic chat interaction |
| 2 | Ask "Explain Python in 3 sentences" | Concise responses |
| 3 | Ask "Write a Python function to sort a list" | Code generation |
| 4 | ollama list | Model management |
| 5 | ollama pull llama3.1:8b | Downloading models |
| 6 | Compare answers between phi3 and llama3.1 | Model quality differences |
| 7 | Ask the same question 3 times | Response consistency |
| 8 | Ask about your code (paste a snippet) | Code analysis |
| 9 | ollama show llama3.1:8b | Model metadata |
| 10 | Ask "What are you good at?" | Model self-assessment |
Common Ollama Problems and Solutions
| Problem | Solution |
|---|---|
| "command not found: ollama" | Restart your terminal after installation, or check PATH |
| "model not found" | Run ollama pull model_name first |
| "out of memory" | Use a smaller model (phi3:mini) or more RAM |
| Very slow responses | Model is running on CPU. Install NVIDIA drivers for GPU acceleration |
| "connection refused" | Start Ollama: ollama serve (or restart the Ollama app) |
| Garbled output | Model may be corrupted. Delete and re-download: ollama rm + ollama pull |
| Model uses too much RAM | Smaller models use less RAM. phi3:mini needs ~4GB, llama3.1:8b needs ~8GB |
| GPU not detected | Install NVIDIA CUDA drivers. On macOS, GPU acceleration is automatic for Apple Silicon |
Hardware Requirements
| RAM | Best Model | Experience |
|---|---|---|
| 8GB | phi3:mini (3.8B) | Basic chat, works but slower on CPU |
| 16GB | llama3.1:8b, mistral:7b | Good for most tasks |
| 32GB | 13B-30B models | Strong performance |
| 16GB + GPU | llama3.1:8b at full speed | Best experience |
Build a Local Command-Line Assistant
The demo includes a complete LocalAssistant class that you can use as a starting point:
FAQ
Q: Is Ollama free?
A: Yes. Ollama is open-source and free to use. Models are also free to download.
Q: Do I need an API key?
A: No. Ollama runs locally. No API key, no account, no subscription.
Q: Does Ollama work offline?
A: Yes. After downloading models, everything runs offline. No internet required.
Q: Can I use Ollama with Python?
A: Yes. Ollama provides a REST API at localhost:11434. Use urllib, requests, or the official ollama Python package.
Q: How much disk space do I need?
A: 5-10 GB for a few small models. Each model is 2-6 GB depending on size and quantization.
Q: Can Ollama use my GPU?
A: Yes. Ollama automatically detects and uses NVIDIA GPUs on Linux/Windows, and Apple Silicon GPU on macOS.
What to Learn Next
Further Reading
- Local AI Explained
- Ollama vs llama.cpp vs LM Studio
- LLM Quantization Explained
- GGUF Explained
- Build a Private Local AI Assistant
- Local AI vs Cloud AI
Continue Learning: Understand what local AI is, compare runtimes, learn about quantization, and build your first local AI assistant.
Discuss this topic on BestWordz Community.