一、前置条件
- 芯片:确保芯片是 Apple Silicon,如 M1、M2、M3、M4;
- macOS 版本:确保系统版本为 12.3+;
- Xcode Command Line Tools:如果没有安装,运行以下命令:
xcode-select --install
- Python:确保版本 3.7+,推荐 3.10,后续使用 conda 来安装对应版本。
接下来是安装 ComfyUI,可以通过手动安装,也可以直接安装 Comfy UI Desktop(桌面版)。
二、手动安装
2.1、安装 PyTorch
ComfyUI 使用 PyTorch 来优化性能。
2.1.1 安装 Anaconda
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh && bash Miniconda3-latest-MacOSX-arm64.sh
2.1.2 创建 Conda 环境
# 创建 conda 环境 comfyui,使用 python 3.12.11
conda create -n comfyui python=3.12.11
# 激活 conda 环境 comfyui
conda activate comfyui
注意:一定激活 comfyui 环境,这样后续的操作才会约束在此环境中。
2.1.3 安装 PyTorch
conda install pytorch torchvision torchaudio -c pytorch-nightly
2.2、安装 ComfyUI
拉取代码:
git clone https://github.com/comfyanonymous/ComfyUI.git
安装依赖:
cd ComfyUI
pip install -r requirements.txt
如果安装过程报错,例如以下报错:
ERROR: Could not find a version that satisfies the requirement comfy-kitchen>=0.2.5 (from versions: none) ERROR: No matching distribution found for comfy-kitchen>=0.2.5
表示源中并没有此依赖。确认下确实没有,原因是使用了清华的源。那么先从官方源安装此组件,然后再安装:
pip install -i https://pypi.org/simple --no-cache-dir comfy-kitchen
2.3、运行 ComfyUI
通过 python 来运行:
python main.py
ComfyUI server 会被启动:
[图片:ComfyUI 启动界面]
此时可以通过浏览器访问 http://127.0.0.1:8188 来访问:


