Run Stable Diffusion XL (SDXL) natively on Apple Silicon Macs (M1 / M2 / M3) using PyTorch with Metal (MPS) acceleration.
This project is based on 🤗 Hugging Face diffusers and uses a simple generate.py script to prompt and generate images locally on macOS.
- Runs Stable Diffusion locally on macOS
- Uses Apple Metal (MPS) instead of CUDA
- Prompts for text input directly in the terminal
- Saves generated images automatically
- Works offline after first model download
- macOS 26+
- Apple Silicon (M1, M2, or M3)
- Python 3.10+
- Xcode Command Line Tools
pipandvirtualenv
Install Xcode CLI tools if needed:
xcode-select --install
git clone https://github.com/El1Leon/Stable_Diffusion_macOS_Metal.git cd Stable_Diffusion_macOS_Metal
python3 -m venv .venv source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
Once everything is installed, run:
python generate.py