DEV Community

Cover image for Installing AUTOMATIC1111 Stable Diffusion Web UI on macOS with Apple Silicon
junian
junian

Posted on • Originally published at junian.net on

Installing AUTOMATIC1111 Stable Diffusion Web UI on macOS with Apple Silicon

I want to play and research about Generative AI, especially image generation with Stable Diffusion, but I don't have an NVIDIA-powered GPU.

Luckily, my MacBook Air, powered with M1 Apple Silicon, is powerful enough for Stable Diffusion.

I'm gonna share with you how I'm able to install and run Stable Diffusion Web UI on macOS with Apple Silicon.

Install Dependencies

The first thing to do is you need to have the Homebrew package manager installed.
If you don't know how you can read the guide here.

Once you have brew ready, we need to install some dependencies.

brew install cmake protobuf rust git wget
Enter fullscreen mode Exit fullscreen mode

Since we're gonna need Python with version 3.10, I'm gonna use a conda distribution so it'll not mess up other apps using different versions of Python.

I personally prefer miniforge because the license is permissive.
But you can also install either Miniconda or Anaconda.

Here is how to install miniforge with brew.

brew install --cask miniforge
Enter fullscreen mode Exit fullscreen mode

Once the installation is finished, we need to initialize the conda environment.

conda init "$(basename "${SHELL}")"
Enter fullscreen mode Exit fullscreen mode

Once it's done, open a new Terminal window.
Next, we'll create a new conda environment called sdwebui and use Python v3.10 with it.

conda create --name sdwebui python=3.10
Enter fullscreen mode Exit fullscreen mode

After we successfully create sdwebui environment, we need to activate it first before installing Stable Diffusion.

conda activate sdwebui
Enter fullscreen mode Exit fullscreen mode

Install and Use Stable Diffusion Web UI

Now we already have all the dependencies to start the Stable Diffusion.
The next thing we need to do is to install the Stable Diffusion WebUI from GitHub.

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
Enter fullscreen mode Exit fullscreen mode

Once it's cloned, move to the directory stable-diffusion-webui and start the Web UI by typing ./webui.sh.

cd stable-diffusion-webui
./webui.sh
Enter fullscreen mode Exit fullscreen mode

It's gonna take some time because it'll download some more dependencies and a default Stable Diffusion Model.

Once it's done, a web browser will show up with http://127.0.0.1:7860 as the address.

Now let's try to create something.
I have the following Prompt to generate a beautiful picture of a bunny.

tiny cute bunny, vibrant diffraction, highly detailed,
intricate, ultra hd, sharp photo, crepuscular rays, in focus
Enter fullscreen mode Exit fullscreen mode

Click Generate and wait until the image is generated.

Tiny Cute Bunny

Now feel free to experiment with the prompt and make something cool!

Close and Exit Stable Diffusion Web UI

To stop or exit Stable Diffusion Web UI, you can't just close the web browser.
You need to go back to the terminal and press Control + c.

After that, it'll signal to exit the Python process used by the Web UI.

Update Stable Diffusion Web UI

If a new version is available, you can update the Web UI by using git pull.

cd stable-diffusion-webui
git pull
Enter fullscreen mode Exit fullscreen mode

It'll only download the new code, it won't take long like the initial setup.

Restart Stable Diffusion Web UI

If you already quit Stable Diffusion Web UI or restarted your macOS, you may want to start it again.
To do that, you just need to activate the sdwebui conda environment again and start with the ./webui.sh.

conda activate sdbwebui
cd stable-diffusion-webui
./webui.sh
Enter fullscreen mode Exit fullscreen mode

After that, you can use the Web UI normally again from the web browser.

Video Tutorial

I also made a video to show you the steps in this article.
Hopefully, it's easy for anyone to follow along.

Subscribe to Junian Dev YouTube Channel

If you like the video, please subscribe to my channel to get new updates.
If you have some questions, don't be shy to ask!

Conclusion

That's all I can show you in this post.
Hope it's useful.
Next time I’ll show you how to install additional models and extensions.

Thanks for reading and see you next time!

References

Top comments (0)