Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Installing ComfyUI on Apple Silicon (M1/M2/M3) – 2025 Update

A clean guide for setting up ComfyUI with MPS (Metal) support using Python 3.11 and pyenv.


Requirements

  • macOS 12.3+ (macOS Sonoma or later recommended)

  • Xcode Command Line Tools:

    xcode-select --install
  • Homebrew installed (https://brew.sh)


1. Install pyenv and Python 3.11

brew install pyenv
pyenv install 3.11.8
pyenv global 3.11.8

Ensure shell integration:

echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
exec "$SHELL"

Check Python version:

python --version  # Should show 3.11.8

2. Clone ComfyUI

git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI

(Optional: Clone Manager)

cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd ..

3. Create Virtual Environment

python -m venv comfyui-env
source comfyui-env/bin/activate

4. Install PyTorch with MPS Support

pip install --upgrade pip
pip install torch torchvision torchaudio

This installs the stable PyTorch version with MPS support.


5. Install ComfyUI Requirements

pip install -r requirements.txt
pip install -r custom_nodes/ComfyUI-Manager/requirements.txt

6. Verify MPS is Working

python
>>> import torch
>>> torch.backends.mps.is_available()
>>> exit()

7. Run ComfyUI with MPS

export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
python main.py --use-mps

You 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-mps

Make it executable:

chmod +x run.sh

Removed or Deprecated Steps

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

✅ Summary

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 Update

A clean guide for setting up ComfyUI with MPS (Metal) support using Python 3.11 and pyenv.


Requirements

  • macOS 12.3+ (macOS Sonoma or later recommended)

  • Xcode Command Line Tools:

    xcode-select --install
  • Homebrew installed (https://brew.sh/)


1. Install pyenv and Python 3.11

brew install pyenv
pyenv install 3.11.8
pyenv global 3.11.8

Ensure shell integration:

echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
exec "$SHELL"

Check Python version:

python --version  # Should show 3.11.8

2. Clone ComfyUI

git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI

(Optional: Clone Manager)

cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd ..

3. Create Virtual Environment

python -m venv comfyui-env
source comfyui-env/bin/activate

4. Install PyTorch with MPS Support

pip install --upgrade pip
pip install torch torchvision torchaudio

This installs the stable PyTorch version with MPS support.


5. Install ComfyUI Requirements

pip install -r requirements.txt
pip install -r custom_nodes/ComfyUI-Manager/requirements.txt

6. Verify MPS is Working

python
>>> import torch
>>> torch.backends.mps.is_available()
>>> exit()

7. Run ComfyUI with MPS

export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
python main.py

8: Running ComfyUI Automatically on macOS with Automator & AppleScript:

Step 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/ComfyUI with your actual ComfyUI path.

  • Make the script executable by running:

    chmod +x /Users/yourusername/ComfyUI/run.sh

9: Create an Automator app using AppleScript

  1. Open Automator and create a new Application.

  2. Add the action Run AppleScript.

  3. Paste this AppleScript code, updating the path if needed:

tell application "Terminal"
    activate
    do script "cd ~/ComfyUI; ./run.sh"
end tell
  1. Save the Automator application anywhere you like (e.g., Desktop).

  2. Double-click the app to launch ComfyUI with your environment activated and MPS enabled.


Removed or Deprecated Steps

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

✅ Summary

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

About

This is missing installation instruction for installing Comfyui on Apple Mac M1/M2, Metal Performance Shaders (MPS) backend for GPU

Resources

Stars

48 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors