How to Set Up ComfyUI on M4 Mac: The Complete Guide
Run Stable Diffusion and FLUX locally on Apple Silicon with full GPU acceleration.
How to Set Up ComfyUI on M4 Mac: The Complete Guide
Run Stable Diffusion and FLUX locally on Apple Silicon with full GPU acceleration.

Apple’s M4 chip is a beast for AI workloads. The Neural Engine combined with unified memory means you can run models that would require a dedicated GPU on Windows. No cloud costs, no rate limits, just your hardware doing the work.
I’ve been running ComfyUI on my M4 Mac Pro for months, generating thousands of images for Apatero.
Here’s exactly how to set it up.
Why ComfyUI Instead of Automatic1111?

ComfyUI uses a node-based workflow system. You connect inputs to outputs like a visual programming language. It looks complex at first, but it’s actually more powerful and flexible than A1111’s tabs-and-buttons approach.
The real benefits are memory efficiency (ComfyUI uses less VRAM), workflow reusability (save complex pipelines as JSON files), better FLUX support, and an active development community with new nodes constantly being added.
Prerequisites
You’ll need macOS 14 Sonoma or later, Homebrew installed, Python 3.10 or 3.11 (not 3.12 yet), and at least 16GB unified memory (32GB+ recommended for larger models).
Check your Python version:
python3 — version
If you don’t have Homebrew, install it first from brew.sh.
Step 1: Install Dependencies
Open Terminal and run:
brew install cmake protobuf rust git wget
These are build tools needed for some Python packages that compile native code.
Step 2: Clone ComfyUI
Create a directory for your AI tools and clone the repo:
mkdir -p ~/AI
cd ~/AI
cd ComfyUI
Step 3: Set Up Python Environment
Always use a virtual environment. This keeps your system Python clean:
python3 -m venv venv
source venv/bin/activate
Your prompt should now show (venv) at the beginning.
Step 4: Install PyTorch for Apple Silicon
This is the critical step. You need the MPS (Metal Performance Shaders) version of PyTorch:
pip install — upgrade pip
pip install torch torchvision torchaudio
Verify MPS is available:
python -c “import torch; print(torch.backends.mps.is_available())”
This should print True. If it prints False, something went wrong with your PyTorch installation.
Step 5: Install ComfyUI Requirements
pip install -r requirements.txt
This takes a few minutes. You might see some warnings about deprecated packages, that’s normal.
Step 6: Download Models
ComfyUI needs model files to generate images. Create the directory structure:
mkdir -p models/checkpoints
mkdir -p models/vae
mkdir -p models/loras
mkdir -p models/clip
For Stable Diffusion 1.5, download from Hugging Face and place in models/checkpoints. For SDXL, same process but larger file (about 6GB). For FLUX, you’ll need the FLUX.1 dev or schnell model.
I recommend starting with FLUX.1 schnell since it’s faster and produces great results:
cd models/checkpoints
wget https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/flux1-schnell.safetensors
Note: Some models require accepting terms on Hugging Face first. Create an account and accept the license before downloading.
Step 7: First Run
Go back to the ComfyUI directory and start it:
cd ~/AI/ComfyUI
source venv/bin/activate
python main.py
You should see output showing it’s loading and eventually a URL like http://127.0.0.1:8188. Open that in your browser.
Step 8: Configure for M4 Performance
By default, ComfyUI works but isn’t optimized. Edit the launch command:
python main.py — force-fp16
The — force-fp16 flag uses 16-bit floating point which is faster on Apple Silicon and uses less memory.
For even better performance with FLUX, add:
python main.py — force-fp16 — lowvram
This processes the image in chunks instead of all at once.
Step 9: Create a Launch Script
Create a file called start.sh in your ComfyUI folder:
!/bin/bash
cd ~/AI/ComfyUI
source venv/bin/activate
python main.py — force-fp16
Make it executable:
chmod +x start.sh
Now you can just run ./start.sh to launch ComfyUI.
Step 10: Install Essential Custom Nodes
The real power of ComfyUI comes from custom nodes. Install ComfyUI Manager first:
cd ~/AI/ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
Restart ComfyUI. You’ll now see a Manager button in the interface. From there you can install nodes with one click.
Essential nodes to install:
ComfyUI-Impact-Pack for face detection and enhancement
ComfyUI-Inspire-Pack for prompt utilities
ComfyUI-KJNodes for quality of life improvements
ComfyUI-Custom-Scripts for workflow helpers
Memory Optimization Tips

M4 Macs share memory between CPU and GPU. Here’s how to maximize what you have:
Close other apps. Safari and Chrome eat memory. Quit them when generating.
Use 512x512 or 768x768 for SD 1.5. Only go higher with SDXL or FLUX.
Enable tiled VAE decode. In your workflow, use the VAE Decode (Tiled) node instead of regular VAE Decode. This processes the image in smaller chunks.
Lower batch size. Generate one image at a time instead of batches.
For FLUX on 16GB Macs, use the — lowvram flag. It’s slower but actually works.
Troubleshooting Common Issues
MPS Backend Not Available
Make sure you have macOS 14+. Run softwareupdate — list to check for updates.
Reinstall PyTorch:
pip uninstall torch torchvision torchaudio
pip install torch torchvision torchaudio
Out of Memory Errors
Add — lowvram flag to your launch command.
Use smaller image sizes.
Make sure other apps are closed.
Models Not Loading
Check the file is in the correct folder (models/checkpoints for most models).
Make sure the file downloaded completely (check file size matches the source).
Refresh the model list in the UI (there’s a refresh button next to the model dropdown).
Workflow Won’t Run
Click on the red nodes. They show what’s missing.
Usually it’s a missing model or custom node.
Check the terminal for specific error messages.
Performance Expectations
On M4 Pro with 24GB RAM running FLUX.1 schnell at 1024x1024, expect about 10–15 seconds per image. SD 1.5 at 512x512 takes about 3–5 seconds. SDXL at 1024x1024 takes about 15–20 seconds.
These numbers vary based on the specific model, LoRAs applied, and number of steps.
Creating Your First Workflow
Open ComfyUI in your browser. The default workflow loads automatically. This is a basic text-to-image setup.
To generate an image:
In the “Load Checkpoint” node, select your model.
In the “CLIP Text Encode (Prompt)” node, type your positive prompt.
In the negative prompt node, add things you don’t want.
Click “Queue Prompt” button (or press Ctrl+Enter).
Watch the progress in the terminal. Your image appears in the output node when done.
Save your workflow with Ctrl+S. Load saved workflows with Ctrl+O.
Setting Up for FLUX Specifically
FLUX requires a different workflow structure than Stable Diffusion. The model comes in parts that need to be loaded separately.
For FLUX.1 schnell, you need the UNET file, CLIP files (both CLIP L and T5), and VAE file.
The basic FLUX workflow connects LoadFluxModel to the sampler, dual CLIP text encoders to the conditioning, and a VAE decode at the end.
ComfyUI Manager has example FLUX workflows you can load and modify.
Where to Find More Workflows
The ComfyUI subreddit is active with people sharing workflows.
Civitai has a workflow section alongside their models.
OpenArt has a curated collection of workflows.
GitHub repos from node creators often include example workflows.
Wrapping Up
You now have ComfyUI running locally on your M4 Mac. No cloud fees, no rate limits, complete privacy.
Start with simple text-to-image workflows. Once comfortable, explore img2img, inpainting, ControlNet, and LoRA training.
If you want to skip the local setup entirely and just generate images, check out Apatero where we handle all this infrastructure for you.
For more Apple Silicon AI guides, I write regularly at AstroSEOBlog.
Questions about your specific setup? Drop them in the comments. Happy generating.
메타데이터
- post_id
- 0ffb86c11dcd
- slug
- how-to-set-up-comfyui-on-m4-mac-the-complete-guide-0ffb86c11dcd
- url
- https://levelup.gitconnected.com/how-to-set-up-comfyui-on-m4-mac-the-complete-guide-0ffb86c11dcd
- canonical_url
- https://levelup.gitconnected.com/how-to-set-up-comfyui-on-m4-mac-the-complete-guide-0ffb86c11dcd
- author_url
- https://medium.com/@kgabeci
- status
- ok
- fetched_at
- 2026-06-12 07:40:50