# 如何在Mac上安裝Stable Diffusion? [AUTOMATIC1111官方安裝文件_Installation on Apple Silicon](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon) ## 我的Mac規格 * CPU: M2 Air, 8核 * Memory: 24GB * MacOS: Ventura 13.4.1 * GPU: 8核 > Mac怎麼看幾核? 左上小的小蘋果--->關於這台Mac--->更多資訊--->一般--->關於最下方的系統報告--->硬體就會有CPU核數,而顯示卡/顯示器就會有GPU核數 ## 安裝Homebrew [Homebrew](https://brew.sh/index_zh-tw) ### 安裝Homebrew 打開終端機,執行以下指令。 ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` ### 將Homebrew增加進PATH 在終端機,執行以下指令。 - 這個命令會將 eval "$(/opt/homebrew/bin/brew shellenv)" 添加到 /Users/daistella/.zprofile 文件的末尾。 - .zprofile 是當您啟動終端機時會執行的 shell 設定文件之一。 ``` (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/daistella/.zprofile ``` 接著,輸入並執行以下指令。 - 立即在當前的 shell session 中加入 Homebrew 到您的 PATH。 ``` eval "$(/opt/homebrew/bin/brew shellenv)" ``` 測試是否可以在終端機中直接使用 Homebrew 命令。 - 如果看到 Homebrew 的版本號顯示在終端機中,那麼表示您已成功設置並可以直接使用 Homebrew 命令。 ``` brew --version ``` ## 安裝一些基本開發套件 打開新終端機,執行以下指令。 - Stable Diffusion WebUI 僅支援 python 3.10 ,其他版本可能會有問題。 ``` brew install cmake protobuf rust python@3.10 git wget ``` ## 下載Stable Diffusion WebUI - 建立一個新資料夾,如sd。 - 點擊鍵盤的option,並點擊該資料夾sd右鍵"拷背「sd」作為路徑名稱"。 - cd進入該資料夾。 ``` cd /Users/daistella/Documents/sd ``` - 從github複製Stable Diffusion WebUI的檔案。 ``` git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui ``` ## 下載Stable Diffusion模型 [Downloading Stable Diffusion Models](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon#downloading-stable-diffusion-models) - 下載Stable Diffusion 1.5: [v1-5-pruned.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5) - 將ckpt檔放到以下資料夾位置: stable-diffusion-webui/models/Stable-diffusion 其他模型下載: [Civitai](https://civitai.com/), [Hugging Face](https://huggingface.co/) ## 啟動Stable Diffusion - 進入Stable Diffusion WebUI資料夾,執行`webui.sh`。 - 第一次啟動時會建立虛擬環境及安裝必要套件。 ``` cd stable-diffusion-webui ./webui.sh ``` - 用瀏覽器連 http://127.0.0.1:7860 進入Stable Diffusion WebUI。  - 看到以下畫面表示成功啟動Stable Diffusion WebUI囉。  - 這是跑在本地端的,所以終端機記得不要關閉。 - 若需要關閉Stable Diffusion WebUI,在終端機Ctrl+C即可。 ## 跑一張圖約41秒  * Stable Diffusion checkpoint: 1.5 * Positive Prompt: Road, big white cottage, lake. Flower cottage switzerland * Negative Prompt: blurry, bad anatomy, extra limbs, poorly drawn face, poorly drawn hands, missing fingers * Sampling method: Euler a * Sampling steps: 20 * Resolution: 512*512 * Batch size: 1 * CFG Scale: 7 * Seed: 930288298  
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up