Running Stable Diffusion on macOS with M1

Environment Setup

I'm using Homebrew as my local package manager but you'll need some basic things installed in order to run these initial commands.

brew install cmake
brew install protobuf
brew install wget

Install Rust

I also use asdf as a version manager so that's how I've decided to install the latest version of Rust.

asdf install rust 1.63.0

Install Conda

Stable Diffusion seems to prefer Conda as an environment manager as well which is built for Python but also supports other languages.


Clone the Repository

git clone
cd stable-diffusion
git fetch origin apple-mps-support
git checkout apple-mps-support

Setup the Conda Environment

conda env create -f environment-mac.yaml
conda activate ldm


Add contiguous() to the end of line 27 here:

attr =

Download Weights

curl "" > sd-v1-4.ckpt

Install Libraries

Note here that installing via the requirements.txt file actually led to a ton of version conflicts so I found it easier to do it one by one.

pip install torch
pip install numpy
pip install omegaconf
pip install Pillow
pip install einops
pip install torchvision
pip install pytorch_lightning
pip install git+[](

Preload Models

python scripts/


python scripts/orig_scripts/ --prompt "grimace from mcdonalds riding a dragon" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1