Mac Studio 2025(M4)でStable Diffusionを動かす
Mac Studioを更新したので、試しにStable Diffusion WebUI (AUTOMATIC1111)を動かしてみた。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'export PATH="$PATH:/opt/homebrew/bin/"' >> ~/.zshrc
source ~/.zshrc
brew install cmake protobuf rust python@3.10 git wget
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
sed -i '' 's/interrogate/interrogate --no-half/' webui-macos-env.sh
python3.10 -m venv .venv
source .venv/bin/activate
python -m ensurepip --upgrade
python -m pip install -U "pip" "wheel"
python -m pip install "setuptools<82"
python -m pip install --no-build-isolation --force-reinstall https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip
rm -rf repositories/stable-diffusion-stability-ai
cat > webui-user.sh <<'EOF'
#!/usr/bin/env bash
export STABLE_DIFFUSION_REPO="https://github.com/w-e-w/stablediffusion.git"
export PIP_NO_BUILD_ISOLATION=1
EOF
chmod +x webui.sh
./webui.sh追記(2026.05.01):以下は古い手順で、動作しない。
python venvだと遅くてダルいので、uvで動かす手順。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'export PATH="$PATH:/opt/homebrew/bin/"' >> ~/.zshrc
source ~/.zshrc
brew install cmake protobuf rust python@3.10 git wget
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
sed -i '' 's/interrogate/interrogate --no-half/' webui-macos-env.sh
sed -i '' 's/py39/py310/' pyproject.toml
echo "[project]\nname = \"StableDiffusionWebui\"\nversion = \"1.9.4\"" | cat - pyproject.toml > temp && mv temp pyproject.toml
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv -p 3.10
source .venv/bin/activate
uv add -r requirements.txt
uv add pip
chmod +x webui.sh
/bin/bash webui.sh手元だとbrewもuvもインストール済みで、そうで無い環境でこれで動くかちょっと怪しいが。以下、各行解説しておくので、トラブったら自分で解決してくださいw
- Homebrewをインストール
- Homebrewのパスを通す
- 設定したパスを有効にする
- stable diffusion webuiが必要とするhomebrewパッケージをインストール
- stable diffusion webuiをクローン
- クローンしたディレクトリに移動
- webui-macos-ev.shを修正
- pyproject.tomlを修正
- pyproject.tomlにプロジェクトの情報を追加
- uvをインストール
- uvでvenvを作成
- venvをactivate
- stable diffusion webuiが必要とするPythonパッケージをインストール
- pipパッケージをインストール
- パーミッション設定
- 実行
pyproject.tomlが全くメンテされてないみたいなので、上記のように簡易的に修正して動かすのがひとまず正解かと。

