MLX and OpenCode: set up local agents on Mac

Learn to connect OpenCode and Xcode to MLX LM server, use a tool-calling model, and scale inference across Macs with macOS 26.2 Thunderbolt RDMA.

Player not loading? Watch on YouTube

This Apple session explains how to set up an AI agent on an Apple silicon Mac using MLX. The speaker separates the stack into the MLX computation framework, MLX LM, an OpenAI-compatible HTTP server, and an agent that calls tools and processes their results.

The setup starts with installing MLX LM through pip and launching its server with a model that supports tool calling. The speaker recommends a small model for the initial test. OpenCode then needs a local provider configuration with the server's localhost URL and expected model name. This gives the coding assistant a local LLM backend. In the pull-request example, inference stays on the Mac while Git commands access the network, so the demonstrated workflow is not entirely offline.

The session also covers continuous batching for concurrent requests and distributed inference across Macs connected through Thunderbolt or Ethernet. The speaker reports nearly fourfold prompt-processing gains on M5 versus M4, and up to threefold distributed inference gains with four nodes using Thunderbolt RDMA, supported starting with macOS 26.2.

Later examples build and revise a SwiftUI iPad drawing app, then connect Xcode to the server through its Intelligence settings. The example uses port 8080, or the port chosen at server launch, before asking the model to inspect and fix a bug.