ComfyUI

...is a node-based interface for AI image generation. It lets you visually build workflows using Stable Diffusion and other AI models.

#1. Install Homebrew

Homebrew is a package manager for macOS. It installs software from the command line.

  • Press command + Space, type "Terminal" and press Enter to open the Terminal. Copy paste the following code and press Enter to run the code:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Type your password if required and press enter (you will not see what you write, it still works).

  • Verify the installation of homebrew by checking the version. This command should show you your installed version:
brew --version

#2. Install Arduino

  • If you have not already, install the Arduino software:
brew install --cask arduino-ide

#3. Install Git

  • Git is a version control system. It lets you download, track, update, and manage code projects from repositories like GitHub.
brew install git

Accept with "y" for yes.

  • Verify the installation:
git --version

#4. Install Python

Python is a programming language. ComfyUI is written in Python, so Python is needed to run it. If you have Python already installed, check if your version is 3.11 or higher.

  • In the Terminal:
brew install python@3.12
  • Verify, that you have version 3.12 (best version to work with comfyUI):
python3 --version

-> In case the answer shows a lower version, try:

which -a python3

-> You receive something like:

/usr/bin/python3
/opt/homebrew/bin/python3

-> You would need to set the "homebrew" python in first position, so that this python version will be chosen, when you work with python.

echo 'export PATH="/opt/homebrew/opt/python@3.12/libexec/bin:$PATH"' >> ~/.zshrc

-> Dann:

source ~/.zshrc

#5. Download ComfyUI

  • Structure: Copy paste the following command and adjust the path where you want to create a new folder: e.g. ~/Documents/HGK/PhysicalComputing/AI or ~/desktop/AI. The command "mkdir" stands for "make directory" and creates your new directory (folder) for this project. To switch to your new folder use "cd" meaning "change directory". In other words you are working over the Terminal within "AI" folder now.
mkdir ~/AI
cd ~/AI

Now you should see your folder name in the title of your Terminal window and right after your user name.

  • Clone ComfyUI:
git clone https://github.com/comfyanonymous/ComfyUI.git
  • Enter the folder:
cd ComfyUI

#6. Create a Virtual Environment venv

A virtual environment (venv) is basically a private, isolated Python installation for one project. ComfyUI is Python software, but it's not just one Python file. It relies on a collection of packages. Imagine your project folder is like a workshop and the venv is your private toolbox.

  • Create the venv:
python3 -m venv venv
  • Activate it:
source venv/bin/activate

You should see "(venv)" now at the beginning of your terminal prompt.

#7. Install Dependencies

Dependencies are additional software libraries that a program needs to function. Think of them as ComfyUI's required building blocks.

Upgrade pip:

pip install --upgrade pip

Install required packages:

pip install -r requirements.txt

Install a library to read serial data from Arduino:

python -m pip install pyserial

#7. Install PyTorch for Apple Silicon

PyTorch is a machine learning framework used to run AI models. ComfyUI uses PyTorch to perform the actual image generation.

Install:

pip install torch torchvision torchaudio

MPS stands for Metal Performance Shaders: It's Apple's machine-learning and GPU-computing framework that allows AI applications like ComfyUI, PyTorch, and Stable Diffusion to use the GPU inside Apple Silicon Macs (M1, M2, M3, M4, etc.).

On Windows PCs with NVIDIA GPUs, AI software typically uses:

PyTorch → CUDA → NVIDIA GPU

On Apple Silicon Macs, AI software uses:

PyTorch → MPS → Metal → Apple GPU

So MPS is essentially Apple's equivalent of CUDA for machine learning workloads.

Verify MPS support:

python3

Then paste the following lines. Expected output: "True".

import torch
print(torch.backends.mps.is_available())

Exit Python:

exit()

#8. Launch ComfyUI

Open Terminal at your ComfyUI directory/folder and run:

python main.py

You should see something like:

Starting server

http://127.0.0.1:8188

Open the address in your browser to start the GUI (= Graphical User Interface).

ComfyUI is now running entirely on your Laptop.

#9. Install a Model

A model is the trained AI file (usually .safetensors) that contains the learned knowledge for generating images. Without a model, ComfyUI cannot create images.

For learning Stable Diffusion 1.5 is just fine. Download the .safetensors file and place it into ComfyUI/models/checkpoints/

modell quality / hardware requirements pros filename
SD 1.5 low learning, LoRAs, experiments v1-5-pruned-emaonly.safetensors
SDXL middle versatile image generation sd_xl_base_1.0.safetensors
SD3.5 high prompt understanding, modern images sd3.5_large.safetensors (Kontaktinformationen erforderlich)
FLUX.1 high quality + prompt adherence flux1-dev-fp8.safetensors
flux1-dev.safetensors
FLUX Kontext high image processing/transformation, comfyUI flux1-kontext-dev.safetensors (Kontaktinformationen erforderlich)
Qwen-Image very high Text within the image, complex composition qwen_image_nvfp4.safetensors

Restart ComfyUI (reload the page). The model should appear in the checkpoint loader node.

#10. Install ComfyUI Manager

ComfyUI Manager makes installing custom nodes much easier.

cd ~/AI/ComfyUI/custom_nodes

Clone:

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

Restart ComfyUI. A new "Manager" button should appear.

#11. Fullscreen Viewer Script

This script opens up a separate window, showing your newest generated image saved to "output" folder.

Stop your ComfyUI server connection. Go to your ComfyUI (venv) in the Terminal and prompt:

pip3 install Pillow

Save this file to your ComfyUI folder.

comfyui-viewerpy.zip (ZIP, 2.21 KB)

Go to ComfyUI folder and run the script standalone in a second terminal tab, alongside your normal ComfyUI start command. Adjust your path:

python3 comfyui_viewer.py --dir ~/Documents/ComfyUI/output

Controls in the viewer window: f toggles fullscreen, Esc drops out of fullscreen, q quits.

#IMPORTANT TERMINAL CODE LINES

  • To start ComfyUI (after you have installed it), your virtual environment needs to be activated:
source venv/bin/activate
  • You can deactivate your venv with:
deactivate
  • Run the main script to start ComfyUI:
python main.py
  • In den übergeordneten Ordner springen:
cd ..