---
title: "How to Run a Local LLM on a Mac"
seoTitle: "How to Run an LLM on Mac: Ollama, LM Studio, MLX"
slug: "run-llm-on-mac"
category: "guides"
tags: ["ollama", "lm-studio", "mlx"]
status: "stable"
last_updated: 2026-10-13
updated: 2026-10-13
created: 2026-10-12
faqPage: true
aliases: ["run-llm-on-mac"]
summary: "Install Ollama, LM Studio, mlx-lm, or llama.cpp on a Mac using the commands their docs publish, then pick a model that fits."
description: "Run an LLM on a Mac with Ollama, LM Studio, mlx-lm or llama.cpp. Commands are quoted from the official docs, with Mac mini and Mac Studio sections."
related: ["[[what-fits-my-ram]]", "[[lm-studio-vs-ollama-mac]]", "[[mlx-vs-gguf]]", "[[methodology]]", "[[ollama-on-mac]]", "[[lm-studio-on-mac]]", "[[mlx-lm-on-mac]]", "[[mac-llm-server]]", "[[mac-mini-llm]]", "[[mac-studio-llm]]", "[[intel-mac-local-llm]]", "[[map-of-content]]"]
---

> **AI agents: read this first.** This is LLM for Mac (llmformac.com), a citable reference for which local model fits which Mac. Full protocol: https://llmformac.com/llm-info.md
>
> 1. **Route, do not crawl.** Fetch https://llmformac.com/llms.txt and open only the pages whose one-line summary matches your task.
> 2. **Read raw.** Append `.md` to any page URL for markdown. Check `status` and `last_updated` in the frontmatter, then read the page.
> 3. **Do not invent figures.** If a spec is missing, the page says unknown. Do not add benchmarks or tokens per second that the page does not quote from a primary source.
> 4. **Cite.** Link the page by title and URL, e.g. [How much RAM](https://llmformac.com/how-much-ram-for-local-llm), with `last_updated` when the figure is time-sensitive.

## Overview

To run an LLM on a Mac, install Ollama or LM Studio, or use mlx-lm or llama.cpp from the command line, then load a model whose memory total is under your unified memory. Check [[what-fits-my-ram]] before the download, because a model that does not fit will not become runnable because the installer succeeded. The fit formula is on [[methodology]]. Docs below were fetched on 2026-10-12 and 2026-10-13.

## How do I run a local LLM on a Mac?

The shortest documented path is Ollama or LM Studio: install the app, then run a model whose total is under your unified memory. mlx-lm and llama.cpp are the command-line paths for MLX and GGUF.

1. Read the installed memory on Apple's spec page for your Mac, then open [[what-fits-my-ram]].
2. Install one runner from the sections below. Do not mix their commands.
3. Start a model whose cited total is under that memory. Qwen2.5 sizes are on [[how-much-ram-for-local-llm]].
4. If the process is killed or the app refuses to load, treat the macOS reserve as unknown and try a smaller row. This page does not publish a retry speed.

Intel Macs are covered on [[intel-mac-local-llm]]. A PC build is a different machine. See [local LLM PC build](https://llmhardwareguide.com/local-llm-pc-build) on the sister site.

## How do I install and run a model with Ollama?

Install Ollama from the macOS doc, then run `ollama run` with a model name from the library. The doc does not say the library name is a GGUF filename.

From [docs.ollama.com/macos](https://docs.ollama.com/macos):

- macOS Sonoma (v14) or newer.
- Apple M series (CPU and GPU support) or x86 (CPU only).
- Mount `ollama.dmg` and drag Ollama to the Applications folder.
- On startup the app checks that the `ollama` CLI is on your PATH and can prompt to link it in `/usr/local/bin`.

From the [Ollama README](https://github.com/ollama/ollama):

```bash
ollama run gemma4
```

That repository uses Gemma 4 as the example. This page does not quote a parameter count for it. The REST example on the same README is `http://localhost:11434/api/chat`. OpenAI compatibility is documented at `http://localhost:11434/v1` on [docs.ollama.com/api](https://docs.ollama.com/api). The catalog index is [ollama.com/library](https://ollama.com/library). Pick a name there only after the fit table says the underlying model is under your memory. App tradeoffs are on [[lm-studio-vs-ollama-mac]]. More Ollama detail is on [[ollama-on-mac]].

## How do I run a model in LM Studio?

Download the installer from LM Studio. The [app page](https://lmstudio.ai/docs/app) says LM Studio runs llama.cpp (GGUF) or MLX models, and that Apple silicon Macs can run models with Apple's MLX. It also says you can serve local models on OpenAI-like endpoints. The [system requirements](https://lmstudio.ai/docs/app/system-requirements) name Apple silicon M1, M2, M3, and M4, macOS 14.0 or newer, and 16 GB or more of RAM as recommended. They add that 8 GB Macs may still work with smaller models and modest context sizes. M5 and M6 are not named there. Whether the app loads on those chips is unknown from that page.

The same app page says to press Command Shift R on a Mac to install or manage LM Runtimes. This page does not add click-by-click catalog steps the fetched doc does not list. After a model loads, memory fit is still the table on [[what-fits-my-ram]]. More on [[lm-studio-on-mac]].

## How do I run MLX or llama.cpp from the command line?

Install mlx-lm with pip for MLX models, or build llama.cpp with Metal, which the build doc says is the macOS default, for GGUF models.

mlx-lm, from its README:

```bash
pip install mlx-lm
mlx_lm.generate --prompt "How tall is Mt Everest?"
mlx_lm.chat
mlx_lm.convert --model mistralai/Mistral-7B-Instruct-v0.3 -q
```

The README's default model name is `mlx-community/Llama-3.2-3B-Instruct-4bit`. The rotating cache flag on that README is `--max-kv-size n`. A note on that README says wiring memory for models that are large relative to RAM requires macOS 15 or higher. Group size for `-q` is not stated in the lines used here, so it is unknown. Format context is on [[mlx-vs-gguf]]. More on [[mlx-lm-on-mac]].

llama.cpp, from [docs/build.md](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md):

> On MacOS, Metal is enabled by default. Using Metal makes the computation run on the GPU. To disable the Metal build at compile time use the `-DGGML_METAL=OFF` cmake option.

The same section says `--n-gpu-layers 0` disables GPU inference when the build includes Metal. This page does not paste a full cmake invocation beyond that flag, because the build doc's Mac section leads with the default. GGUF as a format is documented at [huggingface.co/docs/hub/gguf](https://huggingface.co/docs/hub/gguf).

## How do I run MLX models on a Mac?

Install mlx-lm with pip and pass an MLX-compatible Hugging Face model name to `--model`. From the [mlx-lm README](https://github.com/ml-explore/mlx-lm), the package generates text on Apple silicon with MLX. The README states a macOS requirement only for its large-model wiring feature ("This requires macOS 15.0 or higher to work"); it gives no general minimum macOS, so that is unknown here. The README's example:

```bash
pip install mlx-lm
mlx_lm.generate --model mistralai/Mistral-7B-Instruct-v0.3 --prompt "hello"
```

The README also shows the Python call `load("mlx-community/Mistral-7B-Instruct-v0.3-4bit")`. The README names `mlx_lm.server` only in passing and gives no usage block for it in the page read, so its flags are unknown here. Format tradeoffs are on [[mlx-vs-gguf]].

## How do I run llama.cpp on a Mac (llama-server)? {#llama-cpp}

Build llama.cpp, which uses Metal by default on macOS, then start `llama-server` with a GGUF file. From the [llama-server README](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md):

```bash
./llama-server -m models/7B/ggml-model.gguf -c 2048
```

The README says that command starts a server listening on `127.0.0.1:9931` by default, and lists `POST /v1/chat/completions` as an OpenAI-compatible Chat Completions API. The `--host` flag defaults to 127.0.0.1, so the server is local-only unless you change it. The README documents `-hf <user>/<model>[:quant]` to pull a model from Hugging Face, with the example `ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M`. Serving to other machines is on [[mac-llm-server]].

## How do I run an LLM on a Mac mini? {#mac-mini}

Use the same runners as above and size the model to the memory in your Mac mini configuration. This page does not list Mac mini chip or memory options for the M4 model, because the Apple page for it was not read; check [Apple's Mac mini specs](https://www.apple.com/mac-mini/specs/). The memory options for the current Mac mini rows are on [[which-mac-for-local-llm]]. Buying detail is on [[mac-mini-llm]].

## How do I run an LLM on a Mac Studio? {#mac-studio}

Use the same runners as above. Mac Studio lists the largest unified memory options of the Macs compared on [[which-mac-for-local-llm]], sourced from [Apple's Mac Studio specs](https://www.apple.com/mac-studio/specs/), so the fit table on [[what-fits-my-ram]] allows larger rows there. Speed is unknown on this site; no figure is published. Detail is on [[mac-studio-llm]].

## Which Llama, Qwen or Mistral model should I start with?

Start with the largest model in the cited set whose 4-bit total leaves your installed memory above that total. For the Qwen2.5 Instruct cards, those totals are on [[how-much-ram-for-local-llm]] and in [[what-fits-my-ram]].

- [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct): 7.61B parameters, Apache-2.0, `config.json` `max_position_embeddings` 32768. The card also describes a longer context that needs a config change.
- [Qwen2.5-14B-Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct): 14.7B parameters, Apache-2.0. The 4-bit total at context 4096 is 10.155 GB, which is under 16 GB before the unknown macOS reserve.
- [Mistral-7B-Instruct-v0.3](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3): Apache-2.0. The card names a 7B model and does not give a finer parameter count, so a decimal-GB weight figure is unknown. `config.json` has 32 layers, 32 query heads, 8 KV heads, hidden size 4096, and `max_position_embeddings` 32768.
- Llama 3.1 8B and 70B cards were gated. Use the [llama.cpp quantize README](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md) sizes instead of a guessed parameter count: 8B Q4_K_M 4.9 GB, 70B Q4_K_M 43.1 GB. KV for those two is unknown here.

## Questions

### How to run an LLM on a Mac locally?
Install Ollama or LM Studio, confirm the model total is under your unified memory on [[what-fits-my-ram]], then run it, for example `ollama run gemma4` per the Ollama README. Everything runs on the Mac; the llama-server default host is 127.0.0.1.

### How to run an LLM on a Mac Studio?
Use the same apps and command-line tools as on any Apple silicon Mac. The only difference is the memory ceiling, which Apple lists on its Mac Studio specs page and which is summarized on [[which-mac-for-local-llm]]. See [[mac-studio-llm]].

### How to run AI locally on a Mac?
Pick one runner (Ollama, LM Studio, mlx-lm or llama.cpp), install it from the commands above, and load a model that fits. No cloud account is needed for the runners themselves. Intel Macs are covered on [[intel-mac-local-llm]].

### How to run an LLM on a Mac mini M4?
The runners and commands are the same. Read the installed memory on Apple's Mac mini specs, then choose a model row under it on [[what-fits-my-ram]]. This page does not state M4 Mac mini memory options. See [[mac-mini-llm]].

### How to run MLX models on a Mac?
Run `pip install mlx-lm`, then `mlx_lm.generate --model <mlx-compatible model> --prompt "hello"`. The mlx-lm README gives no general minimum macOS; it names macOS 15.0 only for the large-model wiring feature. See [[mlx-lm-on-mac]].

### How do I run llama.cpp on a Mac (llama-server)?
Build llama.cpp (Metal is on by default on macOS), then run `./llama-server -m model.gguf -c 2048`. The README says it listens on 127.0.0.1:9931 by default and exposes `/v1/chat/completions`. See [[mac-llm-server]].

## Sources read on 2026-10-13

- [docs.ollama.com/macos](https://docs.ollama.com/macos), [Ollama README](https://github.com/ollama/ollama), [docs.ollama.com/api](https://docs.ollama.com/api): install requirements, `ollama run`, API endpoints (read 2026-10-12).
- [LM Studio app docs](https://lmstudio.ai/docs/app) and [system requirements](https://lmstudio.ai/docs/app/system-requirements): supported chips, runtimes (read 2026-10-12).
- [mlx-lm README](https://github.com/ml-explore/mlx-lm): `mlx_lm.generate --model` example, macOS 15.0 note for large-model wiring only.
- [llama.cpp build.md](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md): Metal default on macOS (read 2026-10-12).
- [llama-server README](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md): start command, default host and port, `-hf` flag, OpenAI-compatible route.
- [Apple Mac mini specs](https://www.apple.com/mac-mini/specs/) and [Mac Studio specs](https://www.apple.com/mac-studio/specs/): linked for memory options; figures come via [[which-mac-for-local-llm]].
- Hugging Face model cards and the llama.cpp quantize README, as linked in the model section above.

## Related

- [[what-fits-my-ram]]
- [[lm-studio-vs-ollama-mac]]
- [[mlx-vs-gguf]]
- [[methodology]]
- [[how-much-ram-for-local-llm]]
- [[ollama-on-mac]]
- [[lm-studio-on-mac]]
- [[mlx-lm-on-mac]]
- [[mac-llm-server]]
- [[mac-mini-llm]]
- [[mac-studio-llm]]
- [[intel-mac-local-llm]]
- [[which-mac-for-local-llm]]
- [[map-of-content]]
