A Step-by-Step Guide

Image Generated By Flux using ComfyUI

If you’re looking to leverage ComfyUI for AI-driven workflows and run Flux for advanced functionalities on your Mac, this guide is for you! Whether you’re an AI researcher, developer, or just exploring these tools, follow these step-by-step instructions to get everything up and running smoothly.


What is ComfyUI?

ComfyUI is a powerful, modular, and node-based user interface designed for AI workflows, particularly in image generation and creative AI applications. Unlike traditional command-line tools, ComfyUI provides an intuitive visual programming environment, allowing users to connect different processing nodes to create complex AI pipelines efficiently.

ComfyUI is highly customizable and supports various AI models, including Stable Diffusion, FLUX making it an excellent choice for generative art, AI-assisted design, and automated creative tasks.

How to install ComfyUI on Mac?

Since ComfyUI released the desktop version for Mac(with Apple Silicon) on November 2024, there are ways to install ComfyUI: using the official release or from GitHub.

Prepare Your Mac

Before installing ComfyUI and Flux, ensure your Mac meets the following requirements:

Option 1: Install from Official Release

  1. Go to https://www.comfy.org. You can see the Download button in the centre.
  2. Download the latest release package for macOS.
Download page

Option 2: Install From Github

If you prefer a more flexible setup, you can install ComfyUI via GitHub.

Step1: Install python and git(if you already have python and git installed, you can skip to step2)

You can download the python and git by using Homebrew:

Verify the installations:


If you can see the output like this, you are done.

version check

Step2: Clone the repository

After doing this, you should have the ComfyUI folder in your Mac.

Step3: Set up a virtual environment (optional but recommended)

Using a virtual environment helps isolate dependencies for ComfyUI, ensuring that the required libraries do not interfere with system-wide Python packages. This prevents version conflicts, simplifies dependency management, and allows for easier debugging and updates without affecting other projects.

After doing this you will activate the virtual environment.(You can change the name of virtual environment by yourself).

Virtual Environment

Step4: Install dependencies

If you encounter any dependency issues, try installing torch manually:

Step5: Run ComfyUI

Once running, open http://127.0.0.1:8188/ in your browser to access ComfyUI’s interface.


How to run Flux in ComfyUI ?

Flux is a family of diffusion models by black forest labs, before running the model in ComfyUI. We will try to provide you with a very simple entry-level instance so that you can easily run and generate the images you want. But before that you should also do some preparation.

Step1: Download models

Step2: Run the workflow

ComfyUI uses a PNG metadata embedding technology to embed the workflow JSON data into the metadata of the PNG image. Therefore, the generated PNG image is not just an ordinary image, but also contains ComfyUI’s workflow data. You can drag and drop this image to ComfyUI, and ComfyUI will automatically parse the metadata and rebuild the workflow.

So You can then load or drag the following image in ComfyUI to get the workflow.

example image
example workflow

If you have put all the needed models in the folder, you can press the Queue button at the bottom of the page, and you will get the same image as the example.


Advanced Guide

After successfully running a simple demo workflow using FLUX to generate an image, here are some advanced tips to enhance your experience with ComfyUI. These insights will help you unlock its potential and take your image generation to the next level!

Choose different models

There is another version called FLUX-dev, Flux Dev focuses on testing new features and optimising algorithms. It is suitable for users who want to explore the latest features, but there may be experimental bugs. Schnell is optimised for speed and generates faster. It is suitable for batch processing or low-latency requirements, but may sacrifice some detail quality. If you want to try new features, choose Flux Dev; if you want faster reasoning speed, choose Schnell.

You can find an easy to use checkpoint for the Flux dev https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors  you can put in your: ComfyUI/models/checkpoints/ directory. And you can use the following workflow.

Handling Memory Issues in ComfyUI

While running ComfyUI, you may encounter Out of Memory (OOM) errors. Here are some optimisation strategies:

OOM Problem
  1. Reduce Image Resolution: For example, change 1024x1024 to 512x512.
  2. Lower Sampling Steps: High sampling steps consumes more memory. Try reducing from 30 to 20.
  3. Clear Cache: After generating multiple images, manually clear CUDA using torch.cuda.empty_cache(), also, if you change the model, you should restart the ComfyUI.

If OOM errors persist, consider upgrading your GPU or using cloud-based GPU services.


Congratulations! You’ve successfully installed ComfyUI and integrated Flux on your Mac. Now, you can explore AI-powered workflows, create stunning images, and experiment with animations using Flux nodes.

Happy AI experimenting!

Some example prompts you can use for generating images

References

About the Author

Intern at Research Graph Foundation |  + posts