Intermediate 16 minDev

Aider + Ollama: code in the terminal with a 100% agent local

Aider is a coding assistant that lives in your terminal, next to your Git repository. You describe a change in French, it reads the right files, writes the patch, and automatically commits the result. Connected to Ollama, everything happens on your machine: no code is sent to the cloud. This guide provides a reproducible end-to-end setup—pip installation, a config file pointing to Ollama’s OpenAI-compatible endpoint, model selection based on your VRAM, and the commands that really matter (/add, /architect, /diff). It ends with an honest look at the limitations of local models compared with a cloud model, so you know when local is enough and when it falls short.

By Mohamed Meguedmi·Update 2026-08-27·Tested on macOS 14+

#Why use Aider in the terminal

Where Cline or Continue live in VS Code, Aider embraces the terminal. You stay in your shell, at the root of your Git repository, and converse with the model as if it were a colleague with access to the code. It is a different workflow, closer to the command line, that appeals to people who live in tmux and do not like leaving the keyboard.

Git-focused
Each accepted change becomes a clean commit with a message written by Aider. Your history stays readable, and you can undo any change with a simple git revert.
Automatic repo map
Aider builds a map of your repository (function signatures, classes, structure) and sends it to the model along with the open files. The model understands the context without you loading the entire project.
Editor-agnostic
Aider modifies files on disk. You continue using your usual editor in parallel: Aider sees your changes, and you see its changes.
100% local with Ollama
Connected to Ollama, the model runs on your GPU. Your code and prompts never leave the machine, which makes all the difference for proprietary code or code covered by an NDA.
i
Helping isn’t autocomplete
Aider doesn't gray out text while you type like Copilot. It's a task-oriented conversational agent: “add error handling to this file,” “write tests for this function.” For inline completion, keep Tabby or Twinny alongside it.

#Requirements and installation

The Local Copilot Kit

This guide gets you to the model. The kit gets you to the coding copilot in your editor.

  • Lifetime online access
  • PDF + files
  • Lifetime updates

Three building blocks: Python for Aider, Ollama running with a loaded coding model, and a git repository. Aider requires a git repository to work fully—it is what drives the commits.

  1. 01
    Check Ollama
    Ollama must listen on its default port. Run ollama list to confirm that it responds and see which models are already installed.
  2. 02
    Install Aider
    The recommended approach uses pipx or the official install script, which isolates Aider in its own environment to avoid Python dependency conflicts.
  3. 03
    Navigate to a git repository
    Open a terminal at the root of a version-controlled project. If the project is not yet under git, run git init first: Aider needs it to commit its changes.
Install Aider (recommended isolated method)
# Via pipx (isole Aider, n'encombre pas votre Python système)
python -m pip install --user pipx
pipx install aider-chat

# Vérifier l'installation
aider --version
→
Why pipx instead of plain pip
Aider pulls in a lot of dependencies. With pipx, it lives in its own environment and does not break anything in your Python projects. A classic pip install aider-chat works too, but it will pollute the current environment.

#Configure Aider for Ollama

Aider talks to Ollama through its OpenAI-compatible endpoint. Two things to configure: the base URL of Ollama (an environment variable) and the model to use. The cleanest approach is to place an .aider.conf.yml file at the project root (or in your home directory for a global setting), so you don't have to re-enter the options each time you launch it.

Point Aider to Ollama (environment variable)
# Indique à Aider où trouver l'API Ollama
export OLLAMA_API_BASE=http://127.0.0.1:11434

# Lancer Aider avec un modèle Ollama (préfixe ollama/)
aider --model ollama/qwen3.5:9b

To avoid retyping anything, put these settings in a configuration file. Aider automatically reads an .aider.conf.yml found at the repository root or in your home directory.

.aider.conf.yml (at the project root)
# Modèle principal servi par Ollama (préfixe ollama/ obligatoire)
model: ollama/devstral:24b

# Modèle léger pour les tâches annexes (messages de commit, résumés)
weak-model: ollama/qwen3.5:9b

# Auto-commit des modifications acceptées (comportement par défaut)
auto-commits: true

# Ne pas committer automatiquement les fichiers que VOUS modifiez
dirty-commits: false
!
The Ollama URL does NOT go in the YAML
OLLAMA_API_BASE is an environment variable, not a key in .aider.conf.yml. Export it in your shell (or .bashrc / .zshrc / config.fish) before launching aider. Forgetting this variable is the #1 mistake: Aider then looks for Ollama in the wrong place and fails to connect.
→
Expand the context window
By default, Ollama often truncates the context to 2048 tokens, which cripples Aider’s repo-map. Create an .aider.model.settings.yml file to increase num_ctx (for example, 8192 or more depending on your VRAM). Without it, Aider loses track of large files.
.aider.model.settings.yml (expand the Ollama context)
- name: ollama/devstral:24b
  extra_params:
    num_ctx: 8192

#Which model for your VRAM

Aider sends a lot of context (added files + repo-map) and expects a well-formed patch in return. A model that is too small produces broken diffs that Aider cannot apply. Aim for the largest coder model your GPU can load comfortably, while leaving headroom for context.

Recommended model by VRAM (Q4 quantization, rough estimates)
Available VRAMRecommended modelExpected behavior
8 GBQwen 3.5 9BSimple tasks, short files. Correct diffs one file at a time (256k ctx, Apache 2.0).
12 GBQwen 3.5 9B in Q8Maximum tier quality: more reliable multi-file patches, better use of the repo map.
16 GBDevstral 24B or gpt-oss 20BDevstral (Mistral, Apache 2.0) is designed for coding agents: it follows multistep instructions more reliably.
24 GB and upQwen3-Coder 30B-A3BCode MoE (3B active), 256k ctx: solid, fast diffs, with reasoning close to a cloud assistant on medium-complexity tasks.
VersatileGLM 4.7 Flash (MoE, MIT)Solid alternative, very capable in agent mode if Qwen doesn’t suit you.
i
Devstral, designed for agents
Devstral 24B (Mistral, Apache 2.0) was trained specifically for Aider-style agentic workflows: file editing and following instructions across multiple steps. On 16 GB, it is often a better choice than a general-purpose coder of equivalent size for /architect mode.

#The end-to-end workflow

Here’s the typical workflow for a change, from launching Aider to committing. Once you get into this rhythm, you can chain changes together without ever leaving the terminal.

  1. 01
    Run Aider from the repository root
    Aider starts, reads the config, builds the repo map, and displays a prompt. It indicates the active model and the number of detected files.
  2. 02
    Add the relevant files with /add
    Add only the files the task needs to modify. The fewer files in the context, the more precise the model remains. The repo-map already gives the model a view of the rest of the project.
  3. 03
    Describe the modification in French
    Type your request in natural language: “add email validation to the registration form.” Aider thinks it through, then proposes a patch.
  4. 04
    Review the proposed diff
    Aider shows the diff before applying it. Check it. If something is wrong, reply to correct it: “non, utilise une regex plus stricte”.
  5. 05
    Let Aider commit
    Once the patch is applied, Aider automatically creates a commit with a descriptive message. Your Git history stays clean, and every change is traceable.
  6. 06
    Iterate or cancel
    Continue with the next change. If you don't like an Aider commit, /undo cancels the last commit it created without touching anything else.
A typical Aider session (terminal view)
$ aider
Aider v0.x — model: ollama/devstral:24b
Repo-map: 42 fichiers

> /add src/auth/register.py
Added src/auth/register.py to the chat

> Ajoute la validation de l'email dans le formulaire d'inscription

[Aider propose un diff, l'applique, puis :]
Commit a1b2c3d  feat: valider le format de l'email à l'inscription
→
The /architect mode for complex tasks
For a task that requires thinking before writing, /architect splits the work into two stages: the model first reasons through the plan, then a second pass produces the diff. Locally, this significantly improves the quality of multi-file changes.

#Key commands for everyday use

Aider is controlled with slash commands in its prompt. A handful is enough to cover 90% of use cases.

/add fichier
Adds one or more files to the editing context. Aider will write to these files. Limit yourself to what is strictly necessary.
/drop fichier
Remove a file from the context. Useful when switching tasks to start with a clean context.
/architect
Enables plan-then-code mode: the model first reasons about the approach, then generates the diff. Ideal for nontrivial changes.
/diff
Displays the changes made since the last commit, so you can review what Aider changed before continuing.
/undo
Undo the last commit created by Aider. An immediate safety net if a change goes wrong.
/run commande
It runs a shell command (tests, linter) and feeds the output back into the chat. Aider can then make corrections based on the actual errors.
/ask question
Ask a question about the code WITHOUT triggering a modification or commit. To understand before acting.
→
The test → correction loop
Combine /run with the dialogue: run your tests with /run pytest, Aider sees the failures, you ask it to fix them, it proposes a patch, and you run them again. This test → fix loop is where Aider really shines, even locally.

#Local limitations compared with the cloud

Let's be honest: a local model on 8 to 16 GB doesn't match a cutting-edge cloud model. Knowing the limitations prevents frustration and helps you choose the right tool for the task.

Sometimes malformed diffs
Small models sometimes produce a patch that Aider cannot apply (broken format). Moving to a larger model or increasing num_ctx significantly reduces this problem.
Shorter context
A cloud model can handle dozens of files. Locally, keep the context tight: add only a few files at a time with /add, and rely on the repo-map instead of loading everything.
Multi-file reasoning
Refactors that touch many files at once remain a weak point for local models. Break them into several small tasks, or switch to /architect to structure them.
GPU-dependent speed
Latency depends on your card. A 32B model on a modest card will be slow. If responsiveness is the priority, a well-tuned 7B or 14B is more pleasant for everyday use.
i
The right default: local first, cloud as a fallback
For sensitive code, routine tasks, and offline work, local covers the essentials without exposing anything. Keep the cloud option for massive refactors or deep-reasoning problems—Aider can switch models; you only need to change the model line.
→
All in one, no tinkering
If you want to skip the configuration step and get started right away, the paid Local Code Copilot guide brings together ready-to-use configurations for Ollama, Cline, and Aider, tested and ready to copy and paste, with the model choice already made based on your card.

#Frequently asked questions

Is Aider really free and 100% local with Ollama?+
Yes. Aider is open source and free. Connected to Ollama via OLLAMA_API_BASE, it runs a coding model on your own machine: no subscription, API key, or code sent to the cloud. Once the models are downloaded, it even works offline.
Why won't Aider connect to my Ollama?+
In almost all cases, the missing variable is OLLAMA_API_BASE, or it points to the wrong place. Export it in the shell (not in .aider.conf.yml), and it must target http://127.0.0.1:11434. Also check that ollama list responds correctly and that the model is prefixed with ollama/.
Is a git repository required to use Aider?+
Aider is built around git: it controls automatic commits and the /undo command. Without a git repository, you lose these safeguards. A simple git init is enough to unlock the entire workflow.
Which local model should you choose for Aider?+
Depending on your VRAM: Qwen 3.5 9B on 8 GB (in Q8 on 12 GB), Devstral 24B or gpt-oss 20B on 16 GB, Qwen3-Coder 30B-A3B on 24 GB and above. Devstral (Apache 2.0) is excellent on 16 GB for agent mode and /architect. GLM 4.7 Flash is a solid alternative, very capable in agent mode.
What's the difference between Aider and Cline?+
Aider lives in the terminal and revolves around git (automatic commits, repo-map, slash commands). Cline lives in VS Code with a chat + graphical agent interface. Both connect to Ollama locally. Choose based on your environment: terminal for Aider, editor for Cline.
Did this guide help you?

Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.