{"id":879,"date":"2024-08-06T09:25:47","date_gmt":"2024-08-06T09:25:47","guid":{"rendered":"https:\/\/zahiralam.com\/blog\/?p=879"},"modified":"2024-08-06T09:28:20","modified_gmt":"2024-08-06T09:28:20","slug":"from-zero-to-artist-comfyui-setup-for-m1-m2-and-m3-macs","status":"publish","type":"post","link":"https:\/\/zahiralam.com\/blog\/from-zero-to-artist-comfyui-setup-for-m1-m2-and-m3-macs\/","title":{"rendered":"From Zero to Artist:\u00a0ComfyUI Setup for M1,\u00a0M2,\u00a0and M3 Macs"},"content":{"rendered":"\n<p>This tutorial will guide you through installing ComfyUI on an Apple Silicon Mac (M1, M2, M3) with macOS 12.3 or later. The installation will utilize PyTorch&#8217;s Metal Performance Shaders (MPS) backend for GPU training acceleration.\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before starting, ensure you have the following:\n\n\n\n<ul class=\"wp-block-list\">\n<li>An Apple Silicon Mac (M1, M2, M3)<\/li>\n\n\n\n<li>macOS 12.3 or later<\/li>\n\n\n\n<li>Python 3.7 or later<\/li>\n\n\n\n<li>Xcode command-line tools<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Installation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install Xcode Command-Line Tools<\/h3>\n\n\n\n<p>First, install the Xcode command-line tools:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-1\">xcode-select --install<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#xcode-select%20--install\">\n                            <button class=\"copy-button\" data-label=\"xcode-select --install\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install Miniconda<\/h3>\n\n\n\n<p>If you don&#8217;t already have Miniconda installed, follow the instructions in this <a href=\"https:\/\/zahiralam.com\/blog\/conda-installation-on-apple-silicon-mac-simplified-step-by-step-instructions\/\">guide on installing Conda on Apple Silicon Macs<\/a>.\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Create and Activate a Conda Environment<\/h3>\n\n\n\n<p>Create a new Conda environment for ComfyUI:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-2\">conda create -n comfyui python=3.8\nconda activate comfyui<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#conda%20create%20-n%20comfyui%20python%3D3.8%0Aconda%20activate%20comfyui\">\n                            <button class=\"copy-button\" data-label=\"conda create -n comfyui python=3.8\nconda activate comfyui\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Install PyTorch Nightly with MPS Support<\/h3>\n\n\n\n<p>Install the latest nightly build of PyTorch with MPS support:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-3\">conda install pytorch torchvision torchaudio -c pytorch-nightly<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#conda%20install%20pytorch%20torchvision%20torchaudio%20-c%20pytorch-nightly\">\n                            <button class=\"copy-button\" data-label=\"conda install pytorch torchvision torchaudio -c pytorch-nightly\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Clone the ComfyUI Repository<\/h3>\n\n\n\n<p>Clone the ComfyUI repository from GitHub into a directory of your choice:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-4\">git clone https:\/\/github.com\/comfyanonymous\/ComfyUI.git\ncd ComfyUI<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#git%20clone%20https%3A%2F%2Fgithub.com%2Fcomfyanonymous%2FComfyUI.git%0Acd%20ComfyUI\">\n                            <button class=\"copy-button\" data-label=\"git clone https:\/\/github.com\/comfyanonymous\/ComfyUI.git\ncd ComfyUI\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Install ComfyUI Dependencies<\/h3>\n\n\n\n<p>Install the required Python packages using <code>pip<\/code> within the Conda environment:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-5\">pip install -r requirements.txt<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#pip%20install%20-r%20requirements.txt\">\n                            <button class=\"copy-button\" data-label=\"pip install -r requirements.txt\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Set Up Models<\/h3>\n\n\n\n<p>Create directories for your Stable Diffusion checkpoints and other models:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-6\">mkdir -p models\/checkpoints models\/vae models\/embeddings<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#mkdir%20-p%20models%2Fcheckpoints%20models%2Fvae%20models%2Fembeddings\">\n                            <button class=\"copy-button\" data-label=\"mkdir -p models\/checkpoints models\/vae models\/embeddings\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Downloading Checkpoint Files and VAE Models<\/h4>\n\n\n\n<p><strong>1. Hugging Face Model Hub<\/strong>: The Hugging Face Model Hub provides a vast array of models, including Stable Diffusion. You can easily find and download checkpoints and VAE models from the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/huggingface.co\/models\" target=\"_blank\">Hugging Face Model Hub<\/a>.\n\n\n\n<p><strong>2. Civitai<\/strong>: Civitai is a popular community platform where users share various Stable Diffusion models and VAEs. You can explore and download the specific models you need from <a href=\"https:\/\/civitai.com\/models\" target=\"_blank\" rel=\"noreferrer noopener\">Civitai<\/a>.\n\n\n\n<p>Copy your checkpoint files (e.g., <code>.ckpt<\/code>, <code>.safetensors<\/code>) and VAE models to the appropriate directories:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-7\"># Example commands\ncp \/path\/to\/downloaded\/model.ckpt models\/checkpoints\/\ncp \/path\/to\/downloaded\/model.safetensors models\/checkpoints\/\ncp \/path\/to\/downloaded\/vae_model.ckpt models\/vae\/<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#%23%20Example%20commands%0Acp%20%2Fpath%2Fto%2Fdownloaded%2Fmodel.ckpt%20models%2Fcheckpoints%2F%0Acp%20%2Fpath%2Fto%2Fdownloaded%2Fmodel.safetensors%20models%2Fcheckpoints%2F%0Acp%20%2Fpath%2Fto%2Fdownloaded%2Fvae_model.ckpt%20models%2Fvae%2F\">\n                            <button class=\"copy-button\" data-label=\"# Example commands\ncp \/path\/to\/downloaded\/model.ckpt models\/checkpoints\/\ncp \/path\/to\/downloaded\/model.safetensors models\/checkpoints\/\ncp \/path\/to\/downloaded\/vae_model.ckpt models\/vae\/\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 8: Run ComfyUI<\/h3>\n\n\n\n<p>Launch ComfyUI:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-8\">python main.py<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#python%20main.py\">\n                            <button class=\"copy-button\" data-label=\"python main.py\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>By following these steps, you should have ComfyUI installed and running on your Apple Silicon Mac (M1, M2, M3) using the MPS backend for GPU acceleration. This setup ensures efficient performance and leverages the capabilities of your Mac&#8217;s hardware for advanced Stable Diffusion workflows.\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will guide you through installing ComfyUI on an Apple Silicon Mac (M1, M2, M3) with macOS 12.3 or later. The installation will utilize [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":890,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[214],"tags":[28,222,17,37],"class_list":["post-879","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-installation","tag-apple-silicon","tag-comfyui","tag-mac-m1-m2-m3","tag-stable-diffusion"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/comments?post=879"}],"version-history":[{"count":7,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/879\/revisions"}],"predecessor-version":[{"id":887,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/879\/revisions\/887"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/media\/890"}],"wp:attachment":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/media?parent=879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/categories?post=879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/tags?post=879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}