A clean guide for setting up ComfyUI with MPS (Metal) support using Python 3.11 and
pyenv.
macOS 12.3+ (macOS Sonoma or later recommended)
Xcode Command Line Tools:
xcode-select --installHomebrew installed (https://brew.sh)
brew install pyenv
pyenv install 3.11.8
pyenv global 3.11.8Ensure shell integration:
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
exec "$SHELL"Check Python version:
python --version # Should show 3.11.8git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI(Optional: Clone Manager)
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd ..python -m venv comfyui-env
source comfyui-env/bin/activatepip install --upgrade pip
pip install torch torchvision torchaudioThis installs the stable PyTorch version with MPS support.
pip install -r requirements.txt
pip install -r custom_nodes/ComfyUI-Manager/requirements.txtpython
>>> import torch
>>> torch.backends.mps.is_available()
>>> exit()export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
python main.py --use-mpsYou can also create a launcher script:
``
#!/bin/bash
source comfyui-env/bin/activate
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
python main.py --use-mpsMake it executable:
chmod +x run.shOld Step | Updated Recommendation -- | -- Python via .pkg installer | Use pyenv for version control Anaconda install | Use lightweight venv Nightly PyTorch CPU wheels | Use stable PyTorch (supports MPS) TensorFlow install | Not needed for ComfyUI
This updated guide simplifies your ComfyUI installation for Apple Silicon and ensures best compatibility with MPS and PyTorch 2025 improvements.
# Installing ComfyUI on Apple Silicon (M1/M2/M3) – 2025 UpdateA clean guide for setting up ComfyUI with MPS (Metal) support using Python 3.11 and
pyenv.
-
macOS 12.3+ (macOS Sonoma or later recommended)
-
Xcode Command Line Tools:
xcode-select --install
-
Homebrew installed (https://brew.sh/)
brew install pyenv
pyenv install 3.11.8
pyenv global 3.11.8Ensure shell integration:
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
exec "$SHELL"Check Python version:
python --version # Should show 3.11.8git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI(Optional: Clone Manager)
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd ..python -m venv comfyui-env
source comfyui-env/bin/activatepip install --upgrade pip
pip install torch torchvision torchaudioThis installs the stable PyTorch version with MPS support.
pip install -r requirements.txt
pip install -r custom_nodes/ComfyUI-Manager/requirements.txtpython
>>> import torch
>>> torch.backends.mps.is_available()
>>> exit()export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
python main.pyStep 1: Create the run.sh script Create a shell script named run.sh in your ComfyUI folder with the following content:
#!/bin/zsh
# Kill any process using port 8188 (ComfyUI default)
lsof -ti:8188 | xargs kill -9
# Navigate to ComfyUI directory
cd ~/ComfyUI || exit 1
# Activate virtual environment
source comfyui-env/bin/activate
# Set MPS-specific environment variable
export PYTORCH_ENABLE_MPS_FALLBACK=1 PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
# Run ComfyUI
python main.py --force-fp16 --use-split-cross-attention & # run in background
while ! curl -s http://127.0.0.1:8188 > /dev/null; do
sleep 1
done
open -a "Google Chrome" http://127.0.0.1:8188-
Replace
/Users/yourusername/ComfyUIwith your actual ComfyUI path. -
Make the script executable by running:
chmod +x /Users/yourusername/ComfyUI/run.sh
-
Open Automator and create a new Application.
-
Add the action Run AppleScript.
-
Paste this AppleScript code, updating the path if needed:
tell application "Terminal"
activate
do script "cd ~/ComfyUI; ./run.sh"
end tell-
Save the Automator application anywhere you like (e.g., Desktop).
-
Double-click the app to launch ComfyUI with your environment activated and MPS enabled.
| Old Step | Updated Recommendation |
|---|---|
| Python via .pkg installer | Use pyenv for version control |
| Anaconda install | Use lightweight venv |
| Nightly PyTorch CPU wheels | Use stable PyTorch (supports MPS) |
| TensorFlow install | Not needed for ComfyUI |
This updated guide simplifies your ComfyUI installation for Apple Silicon and ensures best compatibility with MPS and PyTorch 2025 improvements.
Full Changelog: https://github.com/vincyb/Installing-Comfyui-for-Apple-Mac-Silicon/commits/v2.0