Run Aider with a Local Model on Your Mac
Aider is the terminal pair-programmer that edits files in place. Point it at a model served on your own Mac and your prompts and code stay on the Mac, with no per-token bill.
Aider reads the files you add, sends them to a model with your instruction, and applies the edits it gets back. It reaches models through LiteLLM, so any OpenAI-compatible endpoint works, including Rapid-MLX on your Mac.
- Your code stays local. Aider sends files to
localhost, not to a cloud model. - No meter. Edit all day for the cost of electricity.
- Forgiving with small models. Aider's edit blocks are plain text, not tool-call JSON, so small local models handle it well.
The whole thing
- Install Rapid-MLX and serve a model.
- Export
OPENAI_API_BASE,OPENAI_API_KEYandAIDER_MODEL. aider <file>.
1 · Install Rapid-MLX and Aider
curl -fsSL https://rapidmlx.com/install.sh | bash uv tool install --python 3.12 aider-chat
uv tool puts Aider in its own environment (pip install aider-chat works too). Rapid-MLX is also in Homebrew core: brew install rapid-mlx.
2 · Serve a model
rapid-mlx serve qwen3.5-4b-4bit
That's the engine's pick for a 16 GB Mac and the model we verified with. rapid-mlx recipe prints the pick for your memory; Best local LLMs by Mac shows measured speeds per chip. Keep the server running.
3 · Point Aider at it
rapid-mlx agents aider --setup prints the three variables for the model you're serving. Export them in the shell you'll run Aider from:
export OPENAI_API_BASE=http://localhost:8000/v1 export OPENAI_API_KEY=not-needed export AIDER_MODEL=openai/qwen3.5-4b-4bit
Keep the openai/ prefix on the model name: LiteLLM uses it to pick the OpenAI-compatible route. The base URL ends in /v1. Add the exports to ~/.zshrc to keep them across terminals.
4 · Run it
Open Aider on a file and describe the change, or pass it as a one-shot message:
# inside your project folder aider --message "Add a function add(a, b) to hello.py that returns a + b." hello.py
From our run:
hello.py
@@ -1,2 +1,5 @@
def greet(name):
return "Hello, " + name
+
+def add(a, b):
+ return a + b
Tokens: 757 sent, 44 received.
Applied edit to hello.py
Verified on 2026-10-06 with rapid-mlx 0.15.6, Aider 0.86.2 and qwen3.5-4b-4bit on a Mac mini (M2 Pro, 32 GB): with the three exports above, the one-shot edit applied in under 20 seconds. We ran it with --yes-always --no-auto-commits so it wouldn't stop for prompts or commit, plus --no-check-update --no-analytics --no-show-model-warnings; interactively, Aider asks and commits each edit by default.
Frequently asked questions
Can Aider use a local model on a Mac?
Yes. Set OPENAI_API_BASE=http://localhost:8000/v1 and an openai/-prefixed model name, serve the model with Rapid-MLX, and Aider edits your files with the model on your Mac.
Why does the model name need the openai/ prefix?
Aider talks to models through LiteLLM, and the openai/ prefix tells LiteLLM to use the OpenAI-compatible route with your base URL. Without it, LiteLLM tries to match a cloud provider.
Which local model is best for Aider?
Aider is easy on small models, so even qwen3.5-4b-4bit handles single-file edits. For larger changes, use the biggest pick rapid-mlx recipe suggests, such as qwen3.8-27b-4bit from 32 GB.
Where to go next
- Aider reference: model naming, edit formats and recommended aliases.
- Best local LLMs by Mac: measured speed for your chip and memory.
- Rapid-MLX vs mlx-lm: the same weights, measured task by task.
- Other agents: Claude Code, Codex CLI, OpenCode and more.
rapid-mlx serve <alias> serves any model on
localhost:8000/v1.
curl -fsSL https://rapidmlx.com/install.sh | bash
New models and speedups, in your inbox
A short note whenever Rapid-MLX gets faster or adds models worth running on your Mac. No spam — unsubscribe anytime.