Yes, Qwen4-35B-A3B runs well on an Apple Silicon Mac with 24GB of memory or more, and it can be squeezed onto 16GB. Use Unsloth’s 4-bit file (UD-Q4_K_XL, 24.7GB in memory) on 32GB and 36GB Macs, the 3-bit UD-Q3_K_XL on 24GB, and 2-bit files on 16GB and 18GB. The easiest route is brew install llama.cpp and one llama-server command. Two things make it fit: llama.cpp keeps Qwen4’s 11.5GB n-gram table on the SSD, and one Terminal command, sudo sysctl iogpu.wired_limit_mb=..., lets the GPU use more of your memory. Ollama’s default download is 36 to 37GB, so with Ollama plan on 48GB.
Below: which file fits each Mac from 16GB to 128GB, how to check and raise the GPU limit safely, step-by-step setup with llama.cpp, Unsloth Desktop, LM Studio, Ollama and MLX, GGUF vs MLX, the speed to expect on each chip, MTP, context sizes, thinking settings, images, disk space, heat and fixes for common errors.
Can your Mac run it? The short answer
Qwen4-35B-A3B is a mixture-of-experts model: 35 billion parameters in total, but only about 3 billion of them work on each token (Hugging Face counts 3.8 billion). That is why it is fast on a Mac. The catch is memory. All 35 billion parameters must sit in memory, because each token picks a different handful of experts. On a Mac that memory is the unified memory you chose when you bought it, and you cannot add more later.
Here is the whole guide in one table. The file names are Unsloth’s, and every size assumes the 20-billion-parameter n-gram table stays on your SSD (section 2 explains this).
| Your Mac’s memory | Does it run? | What I would use | Context I would start with |
|---|---|---|---|
| 8GB | No | A smaller model; see my 8GB laptop guide | — |
| 16GB | Only just | UD-IQ2_XXS (11.9GB) with a raised GPU limit | 8K tokens |
| 18GB | Yes, tight | UD-IQ2_S (14.0GB) with a raised GPU limit | 16K |
| 24GB | Yes | UD-Q3_K_XL (19.4GB) with a raised GPU limit | 16K to 32K |
| 32GB | Yes, well | UD-Q4_K_XL (24.7GB) with a raised GPU limit | 64K |
| 36GB | Yes, well | UD-Q4_K_XL (24.7GB), no changes needed | 128K |
| 48GB | Yes, very well | UD-Q6_K (29.2GB), or a 4-bit MLX file | 256K |
| 64GB and more | Yes, with room to spare | 8-bit (about 41GB), MLX or Ollama’s default | Up to the full 1M |
Two things in that table surprise most people. First, a 32GB Mac needs one Terminal command before the 4-bit file fits, because macOS does not let the graphics side of the chip use all of your memory. Second, the app you pick changes the minimum. Ollama’s default Qwen4 download is 36 to 37GB, so it wants a 48GB Mac, while llama.cpp and Unsloth Desktop can keep part of the model on the SSD and run it on 24GB.
Why a Mac is different from a PC with a graphics card
If you read my guide for 8GB to 16GB graphics cards, forget most of its tuning. On a PC the model is split between a small, fast graphics card and slower system RAM, and the art is deciding which part goes where. A Mac with Apple Silicon has one pool of unified memory that the CPU and the GPU share. There is nothing to split, which makes a Mac much simpler, but three things work differently.
- The GPU only gets part of the pool. macOS reserves memory for itself and, by default, lets the GPU use only part of the total. The share most often reported is about two-thirds on Macs with 32GB or less and about three-quarters above that. Section 4 shows how to see your own figure and how to raise it.
- Speed comes from memory bandwidth. To write each token, the chip reads the active weights from memory. A Max chip reads memory four to five times faster than a base chip, so the same file writes four to five times faster. The number of CPU cores hardly matters.
- The n-gram table can stay on the SSD. Qwen4 adds a 20-billion-parameter lookup table that Unsloth calls the engram. Each token reads only a few rows of it, so llama.cpp can leave the whole table on disk and read rows on demand. macOS keeps recently read rows in free memory, and gives that memory back when an app needs it. Apple’s fast internal SSDs are good at this.
That last point is why the Unsloth download is bigger than the memory you need. The 4-bit UD-Q4_K_XL download is 36.2GB, but only 24.7GB has to be in memory; the other 11.5GB is the n-gram table. Apps that do not support this trick load everything, which is why Ollama’s and the standard MLX files need 32 to 37GB.
Which file to download for your memory
Unsloth publishes Qwen4 GGUF files from 1-bit to 8-bit. Fewer bits means a smaller file and slightly lower quality. Unsloth’s own tests put UD-Q4_K_XL at 95.0% on a set of maths, reasoning and knowledge tests, against 95.3% for the full model, with UD-IQ4_XS at 95.2% and UD-Q3_K_XL at 94.0%. Below 3-bit the quality drops faster, and the smallest files can get stuck repeating themselves.
| File | Download | In memory (n-gram on SSD) | Good for |
|---|---|---|---|
| UD-IQ1_M | 22.3GB | 10.8GB | Last resort on 16GB |
| UD-IQ2_XXS | 23.4GB | 11.9GB | 16GB Macs |
| UD-IQ2_S | 25.5GB | 14.0GB | 18GB Macs |
| UD-IQ2_M | 26.6GB | 15.1GB | 18GB, if you close everything else |
| UD-IQ3_XXS | 28.7GB | 17.2GB | 24GB with longer context; 32GB without changing the GPU limit |
| UD-Q3_K_XL | 30.9GB | 19.4GB | 24GB Macs |
| UD-IQ4_XS | 32.0GB | 20.5GB | 24GB with nothing else open |
| UD-Q4_K_XL | 36.2GB | 24.7GB | 32GB and 36GB: the sweet spot |
| UD-Q5_K_XL | 43.2GB | 27.8GB | 36GB to 48GB |
| UD-Q6_K | 50.9GB | 29.2GB | 48GB |
| 8-bit | — | about 41GB | 64GB and more |
My picks are a little more careful than Unsloth’s own advice, and here is why. Unsloth suggests UD-IQ4_XS for 24GB devices and UD-IQ3_XXS for 18GB of total memory. Those figures are written for any machine, including PCs where a graphics card’s memory and system RAM add up. On a Mac, macOS, your browser and the model all share that one pool. A 17.2GB file on an 18GB Mac leaves under 1GB for everything else, which ends in heavy swapping. So I go one step down, and you can step up once you see how much room you really have.
Unsloth also recommends UD-Q4_K_XL for “32GB and Macs”. That is right for 32GB and up, but on a 32GB Mac it only fits after you raise the GPU limit in the next section. If you would rather not touch that setting, UD-IQ3_XXS (17.2GB) fits a 32GB Mac as it comes.
The one setting that makes it fit: the GPU memory limit
macOS decides how much unified memory the GPU may lock for its own use. Apple calls the figure the recommended maximum working set, and llama.cpp prints it when it starts. Look for a line like this near the top of the output (the number is different on every Mac):
recommendedMaxWorkingSetSize = 21845.34 MB
That example is what a 32GB Mac often shows: about 21GB, not enough for the 24.7GB file plus its cache. If the model and cache are bigger than this figure, you get an out-of-memory error, a very slow model, or both.
On macOS Sonoma and later you can raise the limit with one command. The number is in megabytes:
sudo sysctl iogpu.wired_limit_mb=27648
Type your Mac password when asked. To see the current setting, run sysctl iogpu.wired_limit_mb; 0 means macOS is using its default. The change lasts until you restart, so a mistake is never permanent. To go back without restarting:
sudo sysctl iogpu.wired_limit_mb=0
How high is safe? Leave macOS at least 3GB on small Macs and 5 to 8GB on bigger ones, more if you keep a browser with many tabs open. These are the values I would use:
| Mac memory | Default GPU share (about) | Value I would set | Leaves for macOS |
|---|---|---|---|
| 16GB | 10.7GB | 13312 | 3GB |
| 18GB | 12GB | 15360 | 3GB |
| 24GB | 16GB | 21504 | 3GB |
| 32GB | 21.3GB | 27648 | 5GB |
| 36GB | 27GB | Not needed for 4-bit; 30720 for 5-bit | 5GB |
| 48GB | 36GB | Not needed; 40960 for 4-bit MLX | 7GB |
| 64GB | 48GB | Not needed | — |
| 128GB | 96GB | 118784 only for very long contexts | 12GB |
The default shares in that table are typical values, not a promise; read the recommendedMaxWorkingSetSize line on your own Mac. Some people make the setting permanent by adding iogpu.wired_limit_mb=27648 to /etc/sysctl.conf. I prefer typing it after each restart, because if you ever set it too high, a restart fixes it.
If the Mac becomes sluggish, shows the spinning wheel, or Activity Monitor’s Memory Pressure turns red, the limit is too high for what else you have open. Lower it, close apps, or use a smaller file. Nothing is damaged; macOS is just short of memory.
Five ways to run it, and which to choose
Every app below runs Qwen4 on the Mac’s GPU through Apple’s Metal. They differ in how easy they are, which files they can use and, most importantly for small Macs, whether they can keep the n-gram table on the SSD.
| If you… | Use |
|---|---|
| have 16 to 32GB and want the most control | llama.cpp (section 6) |
| want an app and have 24GB or more | Unsloth Desktop (section 7) |
| already use LM Studio and have 24GB or more | LM Studio (section 8) |
| already use Ollama and have 48GB or more | Ollama (section 9) |
| want Apple’s MLX framework, or write Python | mlx-lm or oMLX (section 10) |
If you are not sure, start with llama.cpp. It has Qwen4 support from the people who wrote it, it supports every Unsloth file and the built-in speed-up called MTP, and Unsloth’s own Mac speed test used it. It also gives you a chat page in your browser, so you do not have to live in the Terminal.
Way 1: llama.cpp with Homebrew
Qwen4 support arrived in llama.cpp with pull request 33626, merged on 3 December 2026. The Homebrew package at version 1.1.1 already includes it, and Homebrew has ready-made builds for Apple Silicon on macOS Sequoia and newer. If you do not have Homebrew, install it from brew.sh first. Then:
brew install llama.cpp
If you installed llama.cpp before, run brew upgrade llama.cpp instead; an older copy fails with an “unknown model architecture” error. Metal is on by default in the Mac build, so there is nothing else to set.
Start the model
This is the command for a 32GB Mac. Run the sysctl line first (once after each restart), then start the server. The first run downloads about 36GB, so give it time:
sudo sysctl iogpu.wired_limit_mb=27648
llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
--no-mmproj -c 65536 -np 1 -fa on -ctk q8_0 -ctv q8_0 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 \
--port 8080
When you see that the server is listening, open http://127.0.0.1:8080 in Safari or Chrome and chat. What each part does:
| Part | What it does |
|---|---|
-hf unsloth/...:UD-Q4_K_XL | Downloads that file from Hugging Face the first time, then reuses it. |
--load-mode mmap --lazy-mode on | Maps the file instead of copying it, and reads parts only when needed. This is what keeps the n-gram table on the SSD. |
-ot per_layer_token_embd=CPU | Puts the n-gram table on the CPU side, so it is read from disk instead of being locked into GPU memory. Unsloth’s command. |
--no-mmproj | Skips the vision part to save memory. Leave it out if you want to send images (section 16). |
-c 65536 | Context length in tokens. Always set it: without it, llama.cpp may try to take the model’s full 1M. |
-np 1 | One conversation at a time, so the whole context is yours. |
-fa on -ctk q8_0 -ctv q8_0 | Flash attention and an 8-bit context cache, which halves the cache with little quality loss. |
--temp ... --min-p 0.0 | Qwen’s recommended settings for thinking mode (section 15). |
Commands for other Macs
Only the file, the context and the limit change. These are my starting points; raise the context later if the Mac stays responsive.
16GB (experimental: expect the Mac to feel slow while it runs; use non-thinking settings to save context):
sudo sysctl iogpu.wired_limit_mb=13312
llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-IQ2_XXS \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
--no-mmproj -c 8192 -np 1 -fa on -ctk q8_0 -ctv q8_0 \
--reasoning off --temp 0.7 --top-p 0.8 --top-k 20 \
--min-p 0.01 --presence-penalty 1.5 --port 8080
18GB: the same, with iogpu.wired_limit_mb=15360, the file UD-IQ2_S and -c 16384.
24GB:
sudo sysctl iogpu.wired_limit_mb=21504
llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q3_K_XL \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
--no-mmproj -c 16384 -np 1 -fa on -ctk q8_0 -ctv q8_0 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 --port 8080
36GB: the 32GB command without the sysctl line, with -c 131072. 48GB: UD-Q6_K with -c 262144. 64GB and more: an 8-bit file with any context you like, up to -c 1048576.
Prefer to download the files yourself, for example to an external drive? Install the Hugging Face command-line tool (pip install -U huggingface_hub gives you hf) and run:
hf download unsloth/Qwen4-35B-A3B-GGUF \
--include "UD-Q4_K_XL/*" "mmproj-BF16.gguf" \
--local-dir ~/models/qwen4
Then replace -hf ... with -m and the path to the first file in that folder, and add --mmproj ~/models/qwen4/mmproj-BF16.gguf if you want images.
Way 2: Unsloth Desktop
Unsloth, the team that made the GGUF files, also has a free desktop app for macOS, Windows and Linux. Its main advantage on a Mac is that it decides where to keep the n-gram table for you and sets Qwen’s sampling settings automatically, including the extra ones the smallest files need. It can run both GGUF and MLX files.
- Install. Download it from Unsloth’s site, or with Homebrew:
brew install --cask unsloth. - Find the model. Open the Model hub, search for
unsloth/Qwen4-35B-A3B-GGUFand download the file for your memory from section 3. - Chat. Select the file in Chat. Unsloth chooses where the n-gram table goes and turns on MTP with its recommended depth.
- Serve it to other apps (optional).
unsloth run --model unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XLstarts an API server from the Terminal.
Unsloth says its app lets the 4-bit MLX file run on a Mac with 24GB, because it moves the n-gram table to the SSD for MLX too. I have not been able to check that claim on a 24GB Mac, so treat it as Unsloth’s figure. The GPU limit from section 4 still applies to any app: if the model does not fit under it, raise it the same way.
Way 3: LM Studio
LM Studio lists Qwen4 as qwen/qwen4-35b-a3b, a 21.50GB GGUF download, and says you need at least 22GB of memory for it. Search for Qwen4 in the Discover tab, download it and load it. Update LM Studio first, and update its llama.cpp engine from the runtime settings if the model refuses to load; Qwen4 needs a llama.cpp build from December 2026 or later.
Before loading, open the load settings and check these:
- Context length: set it yourself. 16K on a 24GB Mac, 64K on 32GB.
- Flash attention: on.
- K and V cache quantisation: Q8_0, to halve the cache.
- GPU offload: all layers. On a Mac this just means the GPU does the work.
LM Studio’s page does not say whether its file keeps the n-gram table on the SSD, so I give no promise for 24GB. On a 24GB Mac, raise the GPU limit to 21504 first and keep the context short; on 32GB it is comfortable. If LM Studio refuses to load a model it thinks is too big, its model-loading guardrail setting decides that. Relax it only after you have raised the GPU limit, never instead.
LM Studio also has MLX models. Search for Qwen4 with the MLX filter if you want one; the MLX sizes in section 10 apply.
Way 4: Ollama
Ollama added Qwen4 in version 0.40.21. Update the app first, then:
ollama run qwen4
The default tag downloads 36 to 37GB, and the tag list also has qwen4:35b-a3b-q4_K_M (37GB), qwen4:35b-a3b-nvfp4 (36GB, an MLX build) and 114GB full-precision versions. Since version 0.40 Ollama uses Apple’s MLX on Macs for models it supports, which is why two of the tags are labelled MLX.
I could not confirm that Ollama keeps Qwen4’s n-gram table on the SSD. Plan as if the whole 36 to 37GB has to be in memory: a 48GB Mac with the GPU limit at 40960, or 64GB as it comes. On a 32GB Mac use llama.cpp, Unsloth Desktop or LM Studio instead; otherwise Ollama will either refuse to load the model or run it very slowly.
Ollama picks the context length from the memory the GPU can use. To choose it yourself, use the context slider in the app’s settings, or type /set parameter num_ctx 65536 in a chat. For an 8-bit cache, set the environment variable before starting the app; on a Mac that is done with launchctl, as Ollama’s FAQ explains:
launchctl setenv OLLAMA_KV_CACHE_TYPE q8_0
launchctl setenv OLLAMA_CONTEXT_LENGTH 65536
Quit Ollama from the menu bar and open it again for the change to take effect. My Ollama vs llama.cpp memory comparison explains every Ollama setting that changes memory.
Way 5: MLX, Apple’s own framework
MLX is Apple’s machine-learning framework for Apple Silicon, and mlx-lm is its tool for running language models. There are three ready-made 4-bit MLX versions of Qwen4, and they are not the same:
| File | Size | Images | MTP | Needs |
|---|---|---|---|---|
| unsloth/Qwen4-35B-A3B-MLX-4bit | 34.0GB (peak 35–36GB) | No | No | mlx-lm plus Unsloth’s patch file |
| mlx-community/Qwen4-35B-A3B-4bit | 32.2GB (peak about 33GB) | Yes | No | mlx-lm from pull request 2141 |
| mlx-community/Qwen4-35B-A3B-oQ4e-mtp | 35.2GB, or 22.4GB with the n-gram table on SSD | Yes | Yes | The oMLX app, Trust Remote Code on |
Unsloth’s file is the most accurate of the plain 4-bit ones: Unsloth measured 87% lower error (mean KL divergence 0.0432 against 0.3356) than a standard mlx_lm.convert -q 4-bit conversion, on a par with its 4-bit GGUFs. The mlx-community and oMLX files are separate conversions that I have not compared.
Unsloth’s MLX file with mlx-lm
Make a Python environment, install mlx-lm, and put Unsloth’s mlx_qwen4_moe.py (in Unsloth’s GitHub repository under studio/backend/core/inference/) next to your script:
python3 -m venv ~/qwen4-mlx
source ~/qwen4-mlx/bin/activate
pip install -U mlx-lm
from mlx_qwen4_moe import patch_qwen4_moe
patch_qwen4_moe()
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
model, tokenizer = load("unsloth/Qwen4-35B-A3B-MLX-4bit")
messages = [{"role": "user", "content": "Explain unified memory in two sentences."}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True)
sampler = make_sampler(temp=1.0, top_p=0.95, top_k=20, min_p=0.0)
print(generate(model, tokenizer, prompt=prompt, max_tokens=4096, sampler=sampler, verbose=True))
The mlx-community file
Its model card says it needs mlx-lm from pull request 2141 until that is part of a release:
pip install -U git+https://github.com/ml-explore/mlx-lm.git@refs/pull/2141/head
mlx_lm.generate --model mlx-community/Qwen4-35B-A3B-4bit --prompt "hello"
For a server that other apps can use, run mlx_lm.server --model mlx-community/Qwen4-35B-A3B-4bit; it answers OpenAI-style requests on port 8080. A text-only version, mlx-community/Qwen4-35B-A3B-4bit-text, skips the vision part.
oMLX, if you have 32GB
oMLX is a Mac app and server built on MLX. Its oQ4e file includes the vision encoder and the MTP head, and with the app’s SSD N-gram Offload setting on, it needs 22.4GB instead of 35.2GB. That makes it the MLX option for a 32GB Mac (raise the GPU limit to 27648 as for llama.cpp). There are also oQ3e, oQ6e and oQ8e versions for smaller and larger Macs.
The plain 4-bit MLX files load the n-gram table into memory, so they peak at 33 to 36GB. On a 48GB Mac raise the GPU limit to 40960 first; 64GB runs them as they come.
GGUF or MLX: which is better on a Mac?
MLX is Apple’s own framework, so many people assume it must be faster. For Qwen4 right now, the only Mac numbers I could find point the other way, though the two tests were not run in the same way:
| On a MacBook Pro M5 Max (128GB) | Writing speed | Notes |
|---|---|---|
| llama.cpp, UD-Q4_K_XL GGUF | 91.2 tokens/s | Thinking off, greedy, no MTP |
| llama.cpp, same file, MTP depth 1 | 118.5 (code) / 111.1 (prose) | Built-in speed-up, no extra file |
| mlx-lm, Unsloth MLX 4-bit | 75 tokens/s at a 512-token prompt, 69 at 4,096 | 128 tokens written; MLX 0.32.5 |
All three rows are Unsloth’s measurements from its Qwen4 guide. Where MLX was very strong is reading the prompt: 2,711 tokens per second for a 512-token prompt and 3,977 for 4,096 tokens. That matters when you paste in long documents or code.
| GGUF (llama.cpp, Unsloth, LM Studio) | MLX (mlx-lm, oMLX, Ollama’s MLX tags) | |
|---|---|---|
| Smallest Mac | 16GB (1-bit or 2-bit files) | 32GB with oMLX’s SSD offload; 48GB otherwise |
| File choice | 1-bit to 8-bit | Mostly 4-bit, plus oMLX’s 3, 6 and 8-bit |
| n-gram table on SSD | Yes | Only oMLX and Unsloth Desktop |
| MTP speed-up | Yes, every file | Only the oMLX files |
| Images | Yes, with the mmproj file | Depends on the file |
| Best at | Writing speed, small Macs | Reading long prompts |
My advice: use GGUF unless you have a reason to prefer MLX, such as an app or Python project that already uses it. If you have 48GB or more and both are installed, try the same prompt in each and keep whichever feels faster on your Mac.
What speed to expect on your Mac
Only one Mac has published Qwen4 figures so far: Unsloth’s M5 Max, at 91 tokens per second with the 4-bit GGUF. Writing speed on a Mac is limited mostly by how fast the chip reads memory, so I scaled that one figure by each chip’s memory bandwidth to get a rough ceiling for other Macs. Apple gives 614GB/s for the M5 Max and 307GB/s for the M5 Pro; the other figures are Apple’s published bandwidths for those chips.
How to read it:
- About 10 tokens per second is slow reading pace. Usable for short questions, tiring for long answers. Turn thinking off.
- 20 to 30 is faster than you read. Fine for chat and most coding help.
- 40 and up feels instant for chat and is good for coding agents that write a lot.
- Smaller files are a bit faster, because there is less to read per token. A 2-bit file on a 16GB M4 may beat the bar for its chip.
- Older and smaller GPUs often land 20 to 30% below these ceilings, because they run out of GPU power before they run out of bandwidth.
- Reading a long prompt depends on GPU power rather than bandwidth. A base chip has a quarter or less of a Max chip’s GPU cores, so a 10,000-token document can take tens of seconds before the answer starts.
If you measure your own Mac, llama-server prints the prompt and writing speed after every answer, and the browser chat page shows them too.
MTP: the free speed-up in every file
Every Unsloth Qwen4 GGUF includes a small multi-token prediction (MTP) head that guesses the next tokens ahead; the main model then checks them all at once. There is no extra file to download. On the M5 Max, Unsloth measured 1.30 times the speed for code and 1.22 times for prose with one token of lookahead, and recommends two tokens: on the Mac that gave 1.40 times for code. Add this to any llama.cpp command:
--spec-type draft-mtp --spec-draft-n-max 2
Depth 3 and 4 were slower than 2 in Unsloth’s tests, so stop there. MTP helps most with code and other predictable text, and least with creative writing. Unsloth Desktop turns it on by itself. On 16GB and 18GB Macs try it last, once the model runs: it needs a little extra memory for its own working buffers. My llama.cpp MTP guide explains how it works and how to tune it.
How much context your Mac can afford
Qwen4 can read 1,048,576 tokens at once, about 750,000 words. It does that cheaply, because only 10 of its 40 layers keep a growing cache. From the model’s configuration I calculate about 20KB per token with a 16-bit cache, and half that with the 8-bit cache the commands above use.
| Mac memory (4-bit or smaller file) | Context I would start with | Realistic maximum |
|---|---|---|
| 16GB | 8K | 16K |
| 18GB | 16K | 32K |
| 24GB | 16K to 32K | 64K with UD-IQ3_XXS |
| 32GB | 64K | 128K |
| 36GB | 128K | 256K |
| 48GB | 256K | 512K |
| 64GB and more | 512K | The full 1M (10.7GB of cache at 8-bit) |
Bigger is not always better. A long context makes every answer slower to start, and the model’s attention spreads thinner. For chat and most coding, 32K to 64K is plenty. My guide to the memory cost of 1M-token contexts goes deeper, and this one explains how coding tools compact a long conversation before it overflows.
Thinking levels and the right settings
Qwen4 thinks before it answers by default. Thinking makes it better at code, maths and multi-step tasks, but it writes many hidden tokens first, and on a slower Mac that is the difference between a 5-second and a 60-second answer. Qwen supports four effort levels: xhigh, high (the default), low and off. In llama-server, pass --reasoning-effort low, or --reasoning off to switch it off.
Qwen recommends different sampling settings for the two modes:
| Setting | Thinking (default) | Thinking off |
|---|---|---|
| temperature | 1.0 | 0.7 |
| top_p | 0.95 | 0.80 |
| top_k | 20 | 20 |
| min_p | 0.0 | 0.0 |
| presence_penalty | 0.0 | 1.5 |
The non-thinking line for llama.cpp is:
--reasoning off --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.0 --presence-penalty 1.5
With the smallest files (UD-IQ1_S, UD-IQ1_M and UD-IQ2_XXS), Unsloth found the model sometimes loops, and recommends --min-p 0.01 and --presence-penalty 1.5 in both modes. My 16GB command already does that. On 16GB to 24GB Macs I would keep thinking off or low for everyday questions and switch it on for hard problems.
Showing it pictures
Qwen4 understands images and screenshots. In llama.cpp the vision part is a separate projector file (mmproj-BF16.gguf, with F16 and F32 versions too). The -hf option downloads and loads it automatically; my commands add --no-mmproj to save memory. Remove that flag and you can attach images in the browser chat page.
The projector adds roughly another gigabyte of memory (my estimate), so on a 32GB Mac raise the GPU limit by 1024 or shorten the context a little. Among the MLX files, Unsloth’s 4-bit is text only, while the mlx-community and oMLX files include vision; Ollama’s tags all list image input.
Disk space, external drives and SSD wear
Check your free space before you start. The download is bigger than the memory the model uses:
| What you download | Disk space |
|---|---|
| UD-IQ2_XXS GGUF (16GB Macs) | 23.4GB |
| UD-Q3_K_XL GGUF (24GB) | 30.9GB |
| UD-Q4_K_XL GGUF (32GB and 36GB) | 36.2GB |
| UD-Q6_K GGUF (48GB) | 50.9GB |
| MLX 4-bit (Unsloth / mlx-community / oMLX) | 34.0 / 32.2 / 35.2GB |
| Ollama default tag | 36 to 37GB |
| LM Studio’s Qwen4 | 21.5GB |
Leave another 15 to 20GB free on the internal drive for macOS, which uses free space for swap. A full disk makes a memory-tight Mac much worse.
- External SSD: fine for storing models. Set the
LLAMA_CACHEenvironment variable, or usehf download --local-dir. The n-gram table is read during generation, so a slow USB drive can cost some speed; a Thunderbolt or USB4 SSD is close to internal speed. - SSD wear: reading does not wear an SSD; writing does. Reading the n-gram table costs nothing. What does write a lot is heavy swapping, another reason not to set the GPU limit so high that macOS runs short.
- Deleting models: llama.cpp keeps downloads in its cache folder, Ollama with
ollama rm qwen4, LM Studio in its My Models tab.
MacBook Air, heat and battery
Running a 35B model works the GPU as hard as a game. On a Mac with a fan (MacBook Pro, Mac mini, Mac Studio) you will hear it on long answers, and speed stays steady. A MacBook Air has no fan: it runs at full speed for a while, then slows down to stay cool. For short chats you will not notice; for a coding agent that writes for many minutes, you will.
- Plug in. On battery, Low Power Mode and some energy settings lower GPU speed, and long generation drains the battery fast.
- Keep the laptop on a hard surface, not a bed or a lap, so it can shed heat.
- Close games, video editors and other GPU-heavy apps while the model runs.
- If you plan to run Qwen4 all day, a Mac mini or Mac Studio with the same chip is quieter and does not slow down.
Using it from other apps and coding tools
Every option here can act as a local server that speaks the same API as OpenAI, so chat apps, editor plug-ins and coding agents can use Qwen4 instead of a cloud model. Point them at:
| Running | Address | Model name |
|---|---|---|
| llama-server | http://127.0.0.1:8080/v1 | any name |
| mlx_lm.server | http://127.0.0.1:8080/v1 | the model’s Hugging Face name |
| LM Studio server | http://localhost:1234/v1 | qwen/qwen4-35b-a3b |
| Ollama | http://localhost:11434/v1 | qwen4 |
Ollama also has a shortcut that sets up a coding tool for you, for example ollama launch opencode --model qwen4 or ollama launch claude --model qwen4. Coding agents send long prompts, so give the model at least 64K of context, which on a Mac means 32GB or more. On smaller Macs, a chat app is the better fit.
If something goes wrong
| What you see | Cause | Fix |
|---|---|---|
| “unknown model architecture” | llama.cpp, LM Studio’s engine or Ollama is older than Qwen4 | brew upgrade llama.cpp, update the app or its runtime |
| “Model type qwen4_moe not supported” | mlx-lm without Qwen4 support | Use Unsloth’s patch file or mlx-lm from pull request 2141 (section 10) |
| An “Insufficient Memory” or out-of-memory error from Metal | Model and cache are bigger than the GPU limit | Raise the limit (section 4), shorten -c or use a smaller file |
| Ollama says the model requires more system memory | The 36–37GB download does not fit | Use llama.cpp or Unsloth Desktop, or a Mac with 48GB+ |
| The whole Mac freezes or beach-balls | GPU limit set too high; macOS is out of memory | Lower the limit or run sudo sysctl iogpu.wired_limit_mb=0; restart if needed |
| The first answer is very slow, later ones faster | The n-gram table is being read from the SSD and cached | Normal. It speeds up as macOS caches the rows |
| Speed drops after a few minutes | Heat (MacBook Air) or swapping | Plug in, cool it, check Swap Used in Activity Monitor |
| Repeats itself or loops | Very small file, or thinking settings in non-thinking use | Use --min-p 0.01 --presence-penalty 1.5 or a bigger file |
| Thinks for minutes | Default high effort on a slow Mac | --reasoning-effort low or --reasoning off |
| Cannot attach images | Started with --no-mmproj, or a text-only MLX file | Remove the flag; use a file with vision |
The best single tool is Activity Monitor’s Memory tab. Green memory pressure means all is well. Yellow means macOS is compressing memory, which is fine for a while. Red, or Swap Used climbing by gigabytes, means the setup is too big for your Mac.
Common questions
Can I run Qwen4-35B-A3B on an 8GB Mac?
No. Even the 1-bit file needs about 11GB of memory. On 8GB, use a model of 4 to 8 billion parameters; my 8GB laptop guide lists good ones.
Is 16GB really enough?
It starts and answers, with a 2-bit file and a short context, but the Mac has almost no room for anything else and quality is lower. Treat it as a way to try Qwen4, not a daily setup.
Does it work on Intel Macs?
Not usefully. This guide is for Apple Silicon (M1 and later). An Intel Mac would run it on the CPU alone, far too slowly for a model this size.
Is raising the GPU memory limit safe?
Yes. It changes nothing permanent and resets when you restart. The only risk is setting it so high that macOS runs short and the Mac freezes, which a restart fixes.
Which is easiest for a beginner?
Unsloth Desktop or LM Studio: both are normal Mac apps. llama.cpp needs a few Terminal commands but gives the most control and the most file choices.
Is MLX faster than llama.cpp for Qwen4?
Not in the only Mac test published so far: on an M5 Max, llama.cpp wrote 91 tokens per second and mlx-lm about 75, though the tests differed. MLX read long prompts very fast. Try both if you have the memory.
Which is better, a MacBook Pro or a Mac Studio?
With the same chip and memory, they run Qwen4 at the same speed. The Mac Studio stays cooler and quieter in long sessions; the MacBook Pro is portable.
How much memory should I buy for local AI?
For Qwen4 at 4-bit, 32GB is the practical minimum and 48GB is comfortable, leaving room for long contexts and other apps. Memory bandwidth (Pro or Max chip) matters more than CPU cores for speed.
Does it work without internet?
Yes. Once the files are downloaded, everything runs on your Mac. Nothing you type is sent anywhere, unless you connect a tool that does so itself.
Can I run it next to other apps?
On 32GB, a browser and an editor are fine; a video editor or a game is not. On 48GB and more there is room for normal work alongside it.
Can I use the full 1M-token context?
With an 8-bit cache it costs about 10.7GB on top of the model, so it needs 64GB or more. Reading that much text also takes a long time on any Mac.
Should I upgrade from Qwen 3.6?
If your Mac runs Qwen 3.6 35B-A3B today, compare its file with the Qwen4 sizes in section 3 before you switch. My Qwen4 vs Qwen 3.6 comparison covers what you gain.
Your next step
Find your memory in the table at the top, run the sysctl line if your size needs it, and start llama-server with the matching command from section 6. Ask it something you know the answer to, watch the speed it prints, and keep an eye on Activity Monitor’s memory pressure. If it stays green, raise the context or step up one file size; if it turns red, step down. Once it runs, add MTP from section 13 for a free speed-up. If you also have a Windows PC with a graphics card, my Qwen4 guide for 8GB to 16GB cards covers that side.
Sources: Unsloth Qwen4 guide (sizes, Mac speed, MLX tests), Unsloth Qwen4 GGUF files, Unsloth MLX 4-bit card, mlx-community 4-bit card, mlx-community oQ4e card, oMLX, mlx-lm, llama.cpp Qwen4 pull request, Homebrew llama.cpp, Ollama Qwen4 page, Ollama Qwen4 tags, Ollama FAQ, LM Studio Qwen4 page, Qwen4-35B-A3B model card, Apple Newsroom (M5 Pro and M5 Max bandwidth). File sizes, quality scores and the M5 Max speeds are Unsloth’s published figures; app sizes come from each app’s Qwen4 page. The speed estimates for other chips, the cache sizes, the default GPU shares and the file and limit picks for each Mac are my own calculations and judgement, and I have not measured them on each Mac.