Mac 關機時出現長時間「旋轉齒輪」(Spinning Gear),並非單純「清理快取/重置 SMC/PRAM」能解決。本文從啟動/關機架構切入,定位至 launchd (PID 1) 關閉系統服務超時 為核心原因,並給出精準修復方案:縮短導致超時服務的 ExitTimeOut 值。
boot.efi → 蘋果 Logo+轉圈。關機為反向過程:用戶 launchd 退出 → 系統 launchd 關閉所有系統服務 → 核心停機。系統 launchd 發送 SIGKILL 後等待所有服務退出,若有服務超時未退出,整個關機流程卡住。

/var/log >> com.apple.launchd >> launchd-shutdown.system.log。com.apple.xxx: Timeout waiting for service to exit (XX seconds)。
常見超時服務:com.apple.securityd (Keychain/憑證)、com.apple.coreservices.appleevents (AppleEvent 處理)。
對每個超時服務的 LaunchDaemon plist 設定短超時(1~2 秒),強制 launchd 快速繼續關機流程。
# 1. securityd (預設 20s → 改 2s)
sudo defaults write /System/Library/LaunchDaemons/com.apple.securityd ExitTimeOut -int 2
# 2. appleevents (預設 15s → 改 1s)
sudo defaults write /System/Library/LaunchDaemons/com.apple.coreservices.appleevents ExitTimeOut -int 1
輸入管理員密碼確認。修改後立即生效,下次關機驗證。
ExitTimeOut 為 launchd 等待服務優雅退出的最長秒數,超過則發送 SIGKILL 強制終止。/Library/LaunchDaemons 同名檔覆蓋,或製作 LaunchAgent 登入時自動修補。透過日誌定位 → 精準修改 plist,是解決 Mac 關機慢的**唯一科學正規路徑**。