LocalCode is an open-source coding agent that runs large language models locally on Apple Silicon Macs. It combines a model server and an agent loop in a single command, so you can read and edit files, run tests, and execute shell commands without sending your code to a cloud provider. The project targets developers who want the privacy and cost benefits of local inference while still getting an agent that can plan, write, and verify changes.
Why run a coding agent locally
Cloud coding agents such as Claude Code or Cursor use frontier models that are more capable, but they charge per token and upload your codebase to their servers. LocalCode takes the opposite trade-off: the model runs on your Mac, so there is no per-task bill, no account to create, and your prompts and files never leave the machine. The developers acknowledge that a local model is not as smart as the biggest cloud models, but for everyday fixes, test writing, and small features it does the job, and the tooling is built to squeeze the most out of smaller weights [5].
Hardware requirements and model selection
LocalCode requires a Mac with Apple Silicon, macOS 13 or newer, at least 16 GB of unified memory, and Python 3.10 or later [1]. The amount of unified memory determines which models fit. On a 16 GB Mac the GPU memory available to the model is about 10.7 GB, which fits a 12B dense model such as Gemma 4 at 4-bit quantization [2]. A 24 GB Mac opens up 35B MoE models like Qwen 3.6 with only 3B active parameters, and a 32 GB Mac adds Gemma 4 26B-A4B and North Mini Code 30B-A3B to the list [2]. The built-in model picker shows every model that fits your machine, marks the most capable one with a star, and lets you switch at any time with the /models command [1][2].
Installation and first run
Install the package with uv pip install localcode or pip install -U localcode, then change into your project directory and run localcode [1]. On first message the model picker opens; pick a quantization, confirm the download size, and the tool starts llama-server on 127.0.0.1 automatically [1][2]. The server shuts down when you exit. If you want to use the running model from another local app, open /server or run localcode api for an OpenAI-compatible endpoint [1].
Optimizations that make local models viable for coding
LocalCode adds several layers on top of the stock model server to improve speed and memory efficiency. Vendor speculative drafting on Gemma 4, Qwen 3.6, Qwen 3.8, and Muse Glimmer roughly doubles reply speed [1]. When the model rewrites a file it has already read, copy drafting copies the unchanged spans instead of regenerating them, yielding 3.5 to 4× faster rewrites [1]. Prompt cache reuse avoids re-reading the static system prompt each turn, warm-up overlaps the first prompt read with model loading, and precompiled GPU kernels eliminate the half-minute shader compile on first start [1]. Memory pressure is reduced by an 8-bit KV cache by default (half the memory of full precision), while Inkling 2 uses a 16-bit cache that its attention can read directly, cutting 3.3 GB at 128K context and speeding long-prompt reads by 1.4–1.8× [1]. Context is sized from what the server reports, so long chats compact before they run out of room [1].
Practical workflow and known limits
A typical session: name the file you want changed, then name the check that proves the change works (tests, linter, build). The agent reads and edits files, runs your repo’s own commands, and asks before touching anything outside the project [1]. Hidden thinking is off by default so answers arrive immediately; a model that gets stuck thinking is recovered instead of failing [1]. A plan panel keeps a task list and reminds the model to update it, and stuck detection ends a run that makes no progress [1]. The trade-off is honest: a 9B model drops braces, loses track, or writes too much at once, so LocalCode repairs invalid JSON tool calls, retries cut-off answers, stops repeated steps, matches slightly wrong indentation, and cancels cleanly on Ctrl+C [5]. For larger refactors you can plan with a bigger model and build with a faster one; each mode remembers its own model [5].
If you already use Ollama or LM Studio, an alternative LocalCode distribution (npm package localcode-agent) connects to those servers instead of bundling its own [5]. The Draw Things team also ships a Mac app called Local Code that adds image generation, spreadsheet analysis, and browser automation, but it is a separate product with different model offerings and optional cloud credits [6].
Try it on your next bug. One command to install, nothing to sign up for, and your code stays on your Mac.
Sources
- GitHub - mjwsolo/localcode: Agentic coding. Local models. On your Mac.
- LocalCode - mjwsolo.github.io
- LocalCode: the coding agent that runs on your machine
- Local Code Launches as Free, Private AI Assistant Tool for Mac
- GitHub - MAJWCF1234/localcode
- LocalCode
- Local Coding on Mac with MLX-LM and OpenCode · GitHub