How to Install AUTOMATIC1111 Stable Diffusion WebUI on M1/M2 Mac (Apple Silicon)

@workingforlatte

@workingforlatte

on · 7 min read

AUTOMATIC1111 is the most popular web UI available for Stable Diffusion. It's all open-sourced and free to use, below we'll walk through all installation steps and allow you to generate your own AI images.

Step 1: Install Homebrew

Homebrew is a package manager that is used from the Mac command line. We will use it to install required packages needed by the AUTOMATIC1111 WebUI.

First, let's check if you have previously installed Homebrew.

  1. Open your terminal (If you have the Spotlight Search button in your menu bar, click it. Otherwise, you can use the keyboard shortcut: Command + Space. Type "Terminal "
  2. Once open type:
Loading...

If Homebrew is installed you should see a version number:

terminal open on a mac with text command brew-v

Otherwise you’ll receive an error as follows:

If Homebrew is not installed on your computer, follow instructions at https://brew.sh to install it. Copy and paste the line provided under "Install Homebrew", into your terminal and click "Enter".

It shows a page of installation instructions for homebrew with a line to paste into your terminal

a mac terminal window with instructions to download homebrew
The installation script may prompt you to enter your password, this is needed for installation permissions.

You won't see the characters as you type. Press enter when you are done.

Next, you may see an option "The XCode Command Line Tools will be installed ". Press return to continue when prompted, it will take one to two minutes to download and install.

Keep the terminal open and follow the instructions that display after installation: "Add Homebrew to your PATH ". Run the listed commands in your terminal. Next, we'll check the installation finished successfully.

Step 1.1 Verify Homebrew Installation

After you've finished installing Homebrew, check that Homebrew is installed properly. In terminal, run:

Loading...

You should see:

Visit Troubleshooting if you have any issues.

Step 2. Install Requirements

After Homebrew is successfully installed, copy this to your terminal and run:

Loading...

Wait until all packages finish downloading. Keep your terminal open, we will continue using it.

Step 3: Clone the WebUI

In terminal, navigate to the directory/folder where you want to save the application

To do this in the terminal, you would type

before the filepath you wish to save under. For example, if you want to place the application on your desktop, type:

Loading...

Once in your desired folder type:

Loading...

This creates a new folder called "

".

Step 4: Download Stable Diffusion Model

You will need a Stable Diffusion model in order to generate images.

For M1/M2 Macs, we recommend using v1.5 because it will generate images faster:

Download the model below (always opt for

over
for security reasons):

Stable Diffusion v1.5: https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main [7.7 GB]

It's important to point out that SDXL v1.0 was just released on July 22, 2023. This is a monumental upgrade in terms of image quality and complexity. However, it runs extremely slow on M1/M2 Macs at the moment. Will update once performance is fine tuned.

Download SDXL v1.0: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/tree/main [6.94 GB]

Download SDXL Refiners v1.0: https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/tree/main [6.08 GB]

Once your model finishes downloading, place the Stable Diffusion models (

files) in the folder
.

a finder window on a mac with folder for stable diffusion automatic1111

Step 5: Start the WebUI

Still in the terminal, navigate into your new "

" folder by typing:

Loading...

Then, we'll launch the WebUI using the following command (You will use this command anytime you start the WebUI):

Loading...

The first time you run this command, it will install all requirements and may take a while to complete.

The install is finished when you see the line:

Go to this address in your web browser:

Here's what you should see:

Stable Diffusion Automatic1111 Interface

The top right section "Stable Diffusion checkpoint", is where you will switch to any models you have placed in the: "stable-diffusion-webui/models/Stable-diffusion" folder.

Check out other popularly downloaded models here: Top 10 Most Popular Stable Diffusion Models

Step 6: Create Your First Image

For this example, we're using the Stable Diffusion v1.5 model since it's the most usable model on Mac right now.

Enter the prompt:

Loading...

Enter negative prompt:

Loading...

Now click "

" and be ready to be amazed. Here's what I got:

a girl in front of a fruit market wearing a green dress

This was using the default sampler

, but you can play around with which sampler fits your needs best, the results may differ a lot.

I recommend using:

  • DPM++ 2M Karras: Better quality, slow
  • DDIM: Faster image generation, worse quality
  • Euler a: Generally fast and produces the most consistent pictures

Troubleshooting

If you have issues when installing Homebrew

zsh: no such file or directory: ./webui.sh

  • This is most likely because you are in the incorrect folder in your terminal
  • If you haven't used the Terminal before,
    • "
      " is used to navigate into folders/directories
    • "
      " to navigate out of a directory
    • "
      " see all folders in your current directory
    • "
      " to see what directory you are currently in
  • First, make sure you are in the directory where you installed the WebUI. You should see
    after typing the "
    " command.
  • Then, "
    "
  • Now launch your WebUI and it should work
Loading...

Web UI Won't Start

  • If you encounter errors when trying to start the WebUI with
    , try deleting the
    and
    folders form your
    folder and then try updating your WebUI with
    before running
    again.

Poor Performance

If performance is slow (meaning image generation takes longer than a minute for a 512x512 image with 20 steps using any sampler)

  • Try starting with the WebUI with the following command
Loading...
  • If that doesn't help
    • Open Activity Monitor (you can find this in "
      " and check the memory pressure graph under the Memory tab.
    • If the memory pressure chart shows red when generating images try launching the WebUI with the below command:
mac activity monitor
Loading...
  • If the "Memory Pressure" chart still shows red. Try
Loading...
  • If it still takes a while to generate a 512x512 image, open the file
    in a text editor, and change the following line:
    • Change the line (Make sure to remove the
      for the change to take effect
      )
      • to
        • (For reference this is currently on line 14 on my file)
@workingforlatte

About @workingforlatte

Hey there, I'm @workingforlatte, an engineer and solopreneur on a mission to make AI accessible and affordable while indulging in my love for lattes. One day, I hope to treat myself to a luxurious mcol latte, and who knows, maybe even upgrade to an hcol latte (a lofty dream, I know)!

With a deep passion for technology and AI, I bring my engineering expertise to the forefront as I explore the ever-evolving AI landscape. I'm thrilled to be part of this AI blog, sharing my unique insights and unraveling the mysteries of artificial intelligence.

Join me on this exciting journey as we navigate the intricate world of AI together. From tackling complex technical challenges to discovering the endless possibilities of AI, I'm here to inspire and empower fellow tech enthusiasts like you.

Together, let's embark on this adventure of uncovering the wonders of AI and embracing the incredible ways it will shape our future. Get ready to dive into the AI realm alongside me, and let's make AI knowledge accessible and enjoyable for everyone. Cheers to a future filled with AI breakthroughs and, of course, plenty of delicious lattes!

Loading...
footer-logo
Copyright © tinydesk.ai 2024