My Local AI Setup: Mac Studio M5 Max as a Model Server for the Whole House

I stopped running big models on my laptop. A Mac Studio M5 Max with 128 GB runs LM Studio on the home network, and my MacBook, VS Code and my agent all talk to it. Here is the whole setup and the memory math behind it.

Share
Mac Studio on a desk serving local AI models over the home network to a MacBook running a code editor

For a while I ran every local model on my laptop. It worked, but the MacBook got hot, the fans spun up in meetings, and loading a 27B model meant closing half my apps. So I moved the models to a Mac Studio M5 Max with 128 GB of memory and turned it into a small model server for the house.

Now the Mac Studio sits in the corner and runs LM Studio. On my MacBook Pro M5, Hermes Agent and VS Code send their requests to it over the home network, and my chat app, Orca, sits on top of Hermes. The laptop stays cool and the models stay loaded.

This is the exact setup, what fits in 128 GB, and the one macOS setting that most guides skip.

Why a separate model server instead of running models on the laptop

Running the model on the machine you work on sounds simpler. In practice it has three problems:

  • Memory fights. A 27B model at Q4 takes around 18 GB before context. Add a browser, Docker and an IDE and the laptop starts swapping.
  • Heat and noise. Long agent runs keep the GPU busy for minutes. On a laptop that means fans and throttling.
  • Reloading. Close the lid, the server stops. Open it, you wait for the model to load again.

A desktop that never sleeps fixes all three. The models load once and stay in memory, and any device on the network can use them. If you already have a Mac Studio, this costs nothing extra.

My hardware and models

Machine Role What runs there
Mac Studio M5 Max, 128 GB Model server LM Studio with Qwen 3.8 27B and Flint
MacBook Pro M5 Daily work Hermes Agent with Orca chat as its front end, VS Code

The two models are the same pair I settled on after comparing Flint and Qwen 3.8 27B on the MacBook. Flint, from Recursive, is a mixture-of-experts model with about 40B total parameters but only about 2.5B active per token. The active count is why it is fast and good for quick edits and short answers. The total count is why it still needs around 23 GB at Q4. Qwen 3.8 27B is dense and slower, and it is the one I trust with harder code and longer reasoning.

On the MacBook they ran at about 110 and 26 tokens per second, so speed was never the problem. Memory and heat were. If you want numbers for your own machine before deciding which models to keep, my ollama-speed-test script measures tokens per second for every model you have in one run.

No Mac Studio? Any always-on machine works

Nothing in this setup is Mac Studio specific. The server is just LM Studio with the network option turned on, and LM Studio runs on macOS, Windows and Linux. What matters is how much memory the model can use and that the machine stays on.

Server you have Memory the model can use What runs well
Mac mini or MacBook, 16 GB ~11 GB for the GPU by default 7B to 9B models at Q4, quick chat and autocomplete
Mac mini or Mac Studio, 32 to 36 GB ~21 to 24 GB one 14B to 27B dense model at Q4. Flint at Q4 (~23 GB) is too tight here, use a 3-bit build
Mac Studio, 64 GB ~48 GB, more with the sysctl below two mid-size models loaded at once
Mac Studio, 128 GB (mine) ~96 GB, more with the sysctl below several models at once, or a 70B model with long context
PC with an NVIDIA GPU the card's VRAM (12, 16, 24 GB) fast for anything that fits in VRAM, slow once it spills into system RAM

The trade-off is simple. A PC with a 24 GB card is faster than a Mac on models that fit in 24 GB, and much slower on anything bigger. A Mac is slower per token but can hold bigger models because the GPU uses system memory. An old laptop that sits on a shelf can be a fine server for small models, as long as it is plugged in and doesn't sleep.

If you are starting from zero, try the whole thing on one machine first: run LM Studio on your laptop, connect VS Code to localhost:1234, and see which models you actually use. Move them to a separate box only when the laptop starts to struggle.

What fits in 128 GB

On Apple Silicon the CPU and GPU share one pool of memory. That is the whole reason a Mac can run models that would need an expensive GPU on a PC. But the GPU does not get all of it.

By default macOS lets the GPU wire roughly 75% of RAM on machines with more than 36 GB. On my 128 GB Mac Studio that is about 96 GB for models and their context. Here is my rough budget:

Item Approx. size
Qwen 3.8 27B, Q4_K_M ~18 GB
Flint, Q4 ~23 GB
Both loaded ~41 GB
A 70B dense model at Q4, if I want one ~40 GB
KV cache for long contexts several GB per model, grows with context length

My two everyday models take about 41 GB together, so they sit comfortably inside the default 96 GB with plenty of room for long contexts. That headroom is what 128 GB buys: you can keep both loaded all the time and still pull in a 70B model for a hard problem without unloading anything.

On a 64 GB machine the same pair fits too, but only just. Push the context to 32K or more on both and you hit the limit, and LM Studio either refuses to load or slows down. My rule: keep the loaded weights at no more than about 60% of the GPU limit and leave the rest for context.

The GPU memory limit fix: iogpu.wired_limit_mb

Since the Mac Studio does nothing but serve models, there is no reason to keep a quarter of the memory away from the GPU. You can raise the limit with one command:

# Let the GPU use up to 112 GB on a 128 GB Mac (value is in MB)
sudo sysctl iogpu.wired_limit_mb=114688

Check the current value:

sysctl iogpu.wired_limit_mb

0 means macOS uses its default. A few things to know before you do this:

  • The setting resets on reboot. That is a feature: if you set it too high and the system gets unstable, a restart puts it back.
  • Leave room for macOS itself. On 128 GB, a 112 GB limit still leaves 16 GB for the system. On a 64 GB Mac I would stop at 56 GB (57344).
  • On a laptop you also use for work, I would leave the default alone. On a dedicated server it is free performance headroom.
  • This is Mac only. On a PC the limit is simply your GPU's VRAM, and no setting changes it.

To make it stick, put the command in a small LaunchDaemon or just rerun it after a reboot. On a server that rarely restarts, rerunning it by hand is fine.

MLX or GGUF in LM Studio

LM Studio on Apple Silicon can run two kinds of model files:

  • MLX builds use Apple's MLX framework and are usually the faster option on M-series chips.
  • GGUF builds run through llama.cpp. They are everywhere, come in every quantization, and behave the same on Mac, Linux and Windows.

My approach is simple: if an MLX build of the model exists at a sensible quantization (4-bit or Q4_K_M equivalent), I use it. If not, GGUF is fine. The model quality at the same bit width is close enough that I pick on availability and speed, not on format.

Step 1: Serve LM Studio on the local network

By default the LM Studio server only listens on localhost, so other machines can't reach it.

The steps below follow the LM Studio docs for serving on the local network. In the app:

  1. Open the Developer tab.
  2. Open Server Settings and turn on Serve on Local Network.
  3. Turn on Require Authentication and create an API token. Without it, anyone on your Wi-Fi can use your models.
  4. Start the server. The default port is 1234.

If you prefer the terminal, the lms CLI does the same:

lms server start --bind 0.0.0.0 --port 1234

Load the models you want and set a long idle TTL (or disable auto-unload) so they stay in memory between requests. Also turn on LM Studio's option to start the server at login, so a reboot or a power cut doesn't leave the house without models.

LM Studio Server Settings with "Serve on Local Network" enabled

Step 2: Keep the Mac Studio awake and reachable

A server that sleeps is not a server. Turn off system sleep, and let the Mac power back on by itself after a power cut:

# Never sleep the system (display sleep is fine)
sudo pmset -a sleep 0
sudo pmset -a disksleep 0

# Start again automatically after a power failure
sudo pmset -a autorestart 1

Then give the Mac Studio a fixed address. A DHCP reservation on the router is the easiest way, so the IP never changes. You can also use the Bonjour name, like mac-studio.local, but a fixed IP is more reliable for tools that cache connections.

Test it from the MacBook:

curl http://192.168.1.50:1234/v1/models \
  -H "Authorization: Bearer YOUR_LM_STUDIO_TOKEN"

You should get a JSON list with the model IDs. Those IDs are what you type into every client.

Step 3: Point the clients at the Mac Studio

Only two things on the MacBook talk to LM Studio directly: Hermes Agent and VS Code. Both speak the OpenAI API, so the setup is the same three values each time: base URL http://<mac-studio-ip>:1234/v1, the token, and the model ID.

How the pieces connect

Diagram: Orca chat connects to Hermes Agent on the MacBook; Hermes Agent and VS Code call LM Studio on the Mac Studio over the LAN
Orca chat  ->  Hermes Agent  ->  LM Studio on the Mac Studio
               (MacBook)          (192.168.x.x:1234/v1)
VS Code chat  --------------->  LM Studio on the Mac Studio
  • Hermes Agent runs on the MacBook. I configured it with a custom OpenAI-compatible endpoint pointing at the Mac Studio, so the agent loop runs on the laptop while the thinking happens on the server.
  • Orca chat never touches LM Studio. It is the chat window I type into, and it connects to Hermes Agent. Hermes takes the message, does its agent work and calls the models on the Mac Studio. That way the chat gets the agent's tools, not just a bare model.
  • VS Code chat connects to LM Studio directly. Run Chat: Manage Language Models from the command palette, add a Custom Endpoint provider (VS Code docs), and fill in the URL (keep the /v1 at the end), the token and the model ID.

In VS Code I keep both models in the picker: Flint for quick inline questions, Qwen 3.8 27B for agent-mode tasks that touch several files.

I still have Ollama on the MacBook for offline work and quick benchmarks. When I'm away from home, that is the fallback.

Problems I'd watch for

  • Connection refused from the laptop. The server is still bound to localhost. Check that Serve on Local Network is on, then restart the server.
  • macOS firewall prompt. The first time LM Studio listens on the network, macOS asks whether to allow incoming connections. Allow it, or the port stays closed.
  • Model not found errors. The model ID in the client must match what /v1/models returns, exactly.
  • Slow first answer. If the model was unloaded by the idle timer, the first request loads it again. Raise the TTL.
  • Two clients at once. Since version 0.4, LM Studio can answer several requests to the same model in parallel with continuous batching (MLX models got it in 0.4.2). If the agent and VS Code still queue behind each other, check Max Concurrent Predictions in the model's load settings. Each parallel slot needs its own context memory, so on a tight machine keep it low. For one person this is plenty. For a team, it is still one GPU.

Is a Mac Studio worth it just for local AI?

If you are buying one only for this, think about it carefully. For one person, 64 GB is already enough for the 20B to 30B class of models, which cover most coding and writing work. 128 GB is what you pay for when you want several models loaded at once or a 70B model on call. I wrote about where local models can replace Claude and where they can't, and the answer still holds: daily work yes, the hardest problems not always.

If you already have a Mac Studio, or a spare Apple Silicon desktop, turning it into a model server is one of the best things you can do with it. Your laptop gets its memory back, the models never unload, and every device in the house gets the same models.

FAQ

Can LM Studio be used from another computer on the network?

Yes. Turn on Serve on Local Network in the Developer tab's server settings, or start the server with lms server start --bind 0.0.0.0. Other machines then connect to http://<server-ip>:1234/v1.

How much of the Mac's memory can the GPU use for LLMs?

By default macOS gives the GPU roughly 75% of RAM on machines with more than 36 GB. You can raise it with sudo sysctl iogpu.wired_limit_mb=<MB>. The change resets on reboot.

How much memory do I need for local LLMs on a Mac Studio?

64 GB handles models up to about 30B at 4-bit, even two at once. For 70B models or several models loaded together, 96 to 128 GB is the comfortable range, because a 70B model takes around 40 GB at Q4 before context.

Should I use MLX or GGUF models on Apple Silicon?

Use MLX when a good quantization is available, since it is usually faster on M-series chips. GGUF is the fallback with the widest choice of models.

Do I need a Mac Studio for this?

No. Any machine that can run LM Studio and stays on works: a Mac mini, an old MacBook, or a PC with an NVIDIA GPU. The memory available to the model decides which models you can run.

Can VS Code use a model running on another Mac?

Yes. Add a Custom Endpoint in Chat: Manage Language Models, with the server URL ending in /v1, your LM Studio token and the model ID.