Local AI Assistant for macOS: Free, Offline, No API Keys
By: Evgeny Padezhnov
A floating AI assistant that runs entirely on a Mac. No API keys. No subscriptions. No data leaving the machine. The whole setup takes under ten minutes.
Cloud AI services require constant internet, charge per token, and process data on remote servers. According to Local AI Master, local AI keeps data storage on "your computer only" with "zero risk" of security breaches. The local LLM ecosystem on macOS has matured enough to replace cloud assistants for most daily tasks.
This guide covers the full stack: a local inference engine, a compact language model, and a floating window that stays on screen like Spotlight — always one keystroke away.
Why Local Instead of Cloud
Three reasons make local AI practical on modern Macs.
Cost. As noted in a GetStream comparison, local LLM tools are "free and do not require a monthly subscription." Cloud services charge per API request. Local inference is free once the hardware exists. Every Mac with Apple Silicon already has that hardware.
Privacy. Documents, code snippets, and personal notes never leave the device. Glorium Tech describes local AI agents as tools that "never record or analyze your private conversations." For developers handling client code or proprietary logic, this matters.
Offline availability. No Wi-Fi on a flight? The assistant still works. Local AI agents "still work because they don't rely on the cloud," functioning in areas with no internet at all.
Key point: the trade-off is model size. A local 8B-parameter model will not match GPT-4 on complex reasoning. But for code completion, text drafting, brainstorming, and quick lookups — it handles the job.
The Stack: Ollama + Floating UI
The architecture has two layers:
- Ollama — a local inference server that manages model downloads and serves an API on
localhost. - A floating front-end — a lightweight, always-on-top window connected to Ollama's local API.
No Docker required. No Python environments. No GPU drivers to wrestle with. Ollama handles all model optimization for Apple Silicon natively.
Step 1: Install Ollama
A single command installs the inference engine.
brew install ollama
Start the background service:
ollama serve
This launches a local API server at http://localhost:11434. It exposes an OpenAI-compatible API, which means most tools expecting an OpenAI endpoint can point at localhost:11434 and work without changes.
In practice, Ollama's idle memory footprint is minimal. According to a DEV Community comparison, llama.cpp (the engine under Ollama) uses roughly 100MB RAM when idle. The model itself takes more, but only while loaded.
Step 2: Pull a Model
Pick a model that fits the Mac's unified memory. The ollama pull command downloads and optimizes it automatically.
ollama pull llama3.2
For a quick test:
ollama run llama3.2
This drops into an interactive chat right in the terminal. If that works, the backend is ready.
Model Selection by Hardware
Not every model runs well on every Mac. Here is a practical breakdown based on Apple Silicon benchmarks:
| Mac Config | RAM | Recommended Models | Approx. Speed |
|---|---|---|---|
| M1/M2 (8GB) | 8GB | llama3.2:3b, phi3:mini |
15–25 tok/s |
| M1/M2 Pro (16GB) | 16GB | llama3.2:8b, gemma2:9b |
30–45 tok/s |
| M3 Pro (18GB) | 18GB | llama3:8b, qwen:14b, deepseek-coder-v2:16b-lite |
43–65 tok/s |
| M2/M3 Max (32GB+) | 32GB+ | llama3:70b (Q4), mixtral:8x7b |
20–35 tok/s |
Common mistake: pulling a 70B model on a 16GB machine. As SitePoint warns, "A 70B Q4_K_M model can exceed 40GB." The Mac will swap to disk and become unusable. Match the model to available memory.
Key point: for a floating assistant used throughout the day, speed matters more than raw intelligence. A 3B or 8B model answering in under a second beats a 70B model that takes ten seconds per response.
Step 3: Build the Floating Window
This is where the project becomes an actual assistant instead of a terminal command. The goal: a small, always-on-top window that appears with a keyboard shortcut and sends queries to Ollama.
Option A: Enchanted (Zero Code)
Enchanted is a free, native macOS app that connects directly to Ollama. It supports multiple models, conversation history, and runs as a standard Mac window. Set it to "Float on Top" using the built-in macOS window option or a tool like Rectangle.
No code required. Install, point at http://localhost:11434, pick a model, done.
Option B: Custom Floating App with Swift
For full control, a minimal SwiftUI app does the job in under 100 lines. The critical parts:
import SwiftUI
@main
struct FloatingAssistantApp: App {
var body: some Scene {
WindowGroup {
ChatView()
}
.windowStyle(.hiddenTitleBar)
.defaultSize(width: 380, height: 500)
.windowResizability(.contentSize)
}
}
Set the window level to floating in AppDelegate:
func applicationDidFinishLaunching(_ notification: Notification) {
if let window = NSApplication.shared.windows.first {
window.level = .floating
window.isOpaque = false
window.backgroundColor = NSColor.clear
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
}
}
The chat logic calls Ollama's local API:
func sendMessage(_ prompt: String) async throws -> String {
let url = URL(string: "http://localhost:11434/api/generate")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = [
"model": "llama3.2",
"prompt": prompt,
"stream": false
]
request.httpBody = try JSONSerialization.data(withJSONObject: body)
let (data, _) = try await URLSession.shared.data(for: request)
let json = try JSONSerialization.jsonObject(with: data) as? [String: Any]
return json?["response"] as? String ?? ""
}
In plain terms: a 380-pixel-wide panel that floats over all windows, sends text to localhost:11434, and displays the response. No network calls leave the machine.
Option C: Electron or Tauri Wrapper
For web developers, a Tauri app (Rust + HTML/JS) produces a smaller binary than Electron and supports alwaysOnTop natively:
// tauri.conf.json
{
"windows": [{
"title": "AI Assistant",
"width": 380,
"height": 500,
"alwaysOnTop": true,
"decorations": false,
"transparent": true
}]
}
The front-end is a single HTML file. Fetch calls go to http://localhost:11434/api/generate. The entire app compiles to under 10MB.
Step 4: Add a Global Hotkey
An assistant that requires clicking through windows is not an assistant. It needs a keyboard shortcut.
For the Swift version, register a global hotkey using NSEvent.addGlobalMonitorForEvents:
NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { event in
if event.modifierFlags.contains([.command, .shift]) && event.keyCode == 49 {
toggleWindow()
}
}
This binds Cmd+Shift+Space to show/hide the floating window. For Tauri or Electron, use the respective global shortcut APIs.
Alternatively, Raycast or Alfred can trigger a shell script that activates the app window. No custom code needed.
Step 5: Customize the Model
Ollama supports Modelfiles — configuration files that set system prompts, temperature, and context windows. This turns a generic model into a focused assistant.
FROM llama3.2
SYSTEM "You are a concise development assistant. Answer in 1-3 sentences unless asked for detail. Prefer code examples over explanations."
PARAMETER temperature 0.3
PARAMETER num_ctx 4096
Build and run:
ollama create dev-assistant -f ./Modelfile
ollama run dev-assistant
As documented by iTechWonders, the num_ctx parameter controls the context window. The default is often 2048 tokens. Bumping it to 4096 or 8192 allows longer conversations and larger code blocks, but increases memory usage.
Tested in production: a temperature of 0.3 produces more deterministic answers. Good for code. Bump to 0.7–0.8 for creative writing or brainstorming.
What This Setup Cannot Do
Honesty matters more than hype. Here is what does not work well:
Long-document analysis. A 4096-token context window holds roughly 3000 words. Feeding a 20-page document into a local 8B model will produce truncated or incoherent summaries. Cloud models with 128K+ context still win here.
Image understanding. Multimodal local models exist (LLaVA, BakLLaVA) but run slowly on consumer hardware and produce lower-quality results than cloud alternatives.
Complex multi-step reasoning. An 8B model handles "explain this error" well. It struggles with "design a database schema for a multi-tenant SaaS platform with these 15 constraints." For that, a larger cloud model is still the better tool.
If it works — it is correct. For 80% of daily questions — code snippets, shell commands, text rewrites, quick explanations — a local 8B model is fast enough and good enough.
Security Considerations
Running a local API server has implications even on localhost.
By default, Ollama binds to 127.0.0.1:11434. Only processes on the same machine can reach it. Do not change the bind address to 0.0.0.0 unless the machine sits behind a firewall and access is intentional.
Common mistake: exposing the Ollama port to the local network for "convenience." There is no authentication on the default API. Anyone on the same Wi-Fi could send requests and read responses.
If remote access is genuinely needed, put a reverse proxy with authentication in front. Caddy or nginx with basic auth takes five minutes to configure and prevents accidental exposure.
Performance Tuning
A few adjustments improve daily usability.
Keep the model loaded. Ollama unloads models after 5 minutes of inactivity by default. Set OLLAMA_KEEP_ALIVE=-1 as an environment variable to keep the model in memory permanently. First-response latency drops from several seconds to under 200ms.
export OLLAMA_KEEP_ALIVE=-1
ollama serve
Use quantized models. All Ollama models are quantized by default (typically Q4_K_M). Pulling the q4_K_M variant explicitly ensures the smallest usable model:
ollama pull llama3.2:8b-instruct-q4_K_M
Monitor memory. Activity Monitor on macOS shows unified memory usage. If the system starts compressing memory aggressively, the model is too large. Drop to a smaller variant.
Frequently Asked Questions
How much RAM do I need to run different local models on Apple Silicon?
A 3B model needs roughly 2–3GB of RAM. An 8B model needs 5–6GB. A 14B model needs 9–10GB. Leave at least 4GB free for macOS and other applications. On an 8GB Mac, stick with 3B models.
Why am I getting 404 errors when connecting local tools like Ollama to my AI assistant?
The most common cause: Ollama is not running. Verify with curl http://localhost:11434/api/tags. If it returns a JSON list of models, the server is up. If it returns a connection error, run ollama serve first. Also check that the API path matches — Ollama uses /api/generate for completions, not /v1/chat/completions.
Is it safe to expose my AI assistant's control dashboard to the network?
No. Ollama has no built-in authentication. Binding to 0.0.0.0 lets anyone on the network send prompts and receive responses. Keep it on 127.0.0.1 or add a reverse proxy with authentication if remote access is required.
What should I do if my self-hosted AI agent modifies its own configuration files without permission?
This typically happens with agentic frameworks that grant file-system access. Ollama's base API does not write to disk beyond its model cache in ~/.ollama. If using an agent wrapper, restrict file-system permissions to read-only for sensitive directories and audit the tool-call configuration before granting write access.
Try It
Open a terminal right now and run three commands:
brew install ollama
ollama serve &
ollama run llama3.2
That is a working local AI assistant in under five minutes. The floating window, the hotkey, the custom Modelfile — those come next. But the core works right now, on the hardware already on the desk. Zero dollars. Zero data sent anywhere.
The local LLM ecosystem is maturing fast. What was experimental two years ago is now production-ready. The only question left is which model to try first.
Information is accurate as of the publication date. Terms, prices, and regulations may change — verify with relevant professionals.