Installing ComfyUI on Apple Silicon
Complete guide to running ComfyUI on Mac Studio M4 Max with Metal GPU acceleration.
Prerequisites
- Mac with Apple Silicon (M1/M2/M3/M4)
- macOS 13+
- Homebrew package manager
Installing Homebrew (Step-by-Step)
Homebrew is the package manager for macOS. Follow these steps to install it:
- Open Terminal:
Press Cmd+Space, type “Terminal” and press Enter. Or find Terminal in Applications > Utilities. - Install Homebrew:
Copy and paste this command into Terminal:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Enter your password:
When prompted, type your Mac login password (you wont see characters as you type – this is normal for security). Press Enter. - Wait for installation:
Homebrew will download and install files. This may take a few minutes. Do not close Terminal. - Add Homebrew to PATH:
After installation completes, run these two commands:echo "eval "$(brew --env)"" >> ~/.zshrcsource ~/.zshrc - Verify installation:
Run this command to confirm Homebrew is working:brew doctor
If you see “Your system is ready to brew”, Homebrew is installed correctly.
Installation Steps
- Install PyTorch with Metal support:
brew install pyTorch - Clone ComfyUI:
git clone https://github.com/comfyanonymous/ComfyUI - Download models:
Place model files in ~/.comfyui/models/ - Navigate to ComfyUI directory:
cd ComfyUI
Launch Command for Mac Studio M4 Max 36GB
For Mac Studio M4 Max with 36GB unified memory, use these environment variables to optimize memory usage:
PYTORCH_ENABLE_MPS_FALLBACK=1
PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 python main.py –auto-launch –use-split-cross-attention –lowvram –preview-method auto –enable-manager –listen –output-directory ~/Desktop
Usage
- Open browser to http://localhost:8188
- Drag workflows onto canvas
- Click Queue to generate
Memory Optimization Notes
- –lowvram: Reduces VRAM usage, essential for 36GB models
- –use-split-cross-attention: Improves memory efficiency
- PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0: Prevents memory spikes