Skip to content

Instantly share code, notes, and snippets.

@YukiMatsumura
Created March 19, 2026 02:08
Show Gist options
  • Select an option

  • Save YukiMatsumura/40233e078dcb6b687a49782013bce2c7 to your computer and use it in GitHub Desktop.

Select an option

Save YukiMatsumura/40233e078dcb6b687a49782013bce2c7 to your computer and use it in GitHub Desktop.
ディスプレイ接続が瞬断されて暗転する場合のログ取得(MacOS向け)
#!/bin/bash
# ディスプレイ暗転検出用ログモニター
# 次に暗転が起きたら、このスクリプトの出力を共有してください
LOG_FILE="/tmp/display_dropout_$(date +%Y%m%d_%H%M%S).log"
echo "=== Display Dropout Monitor ===" | tee "$LOG_FILE"
echo "Started at: $(date)" | tee -a "$LOG_FILE"
echo "Monitoring... (Ctrl+C to stop)" | tee -a "$LOG_FILE"
echo "Log file: $LOG_FILE" | tee -a "$LOG_FILE"
echo "---" | tee -a "$LOG_FILE"
/usr/bin/log stream \
--predicate 'sender == "kernel" OR process == "WindowServer" OR subsystem BEGINSWITH "com.apple.iogpu"' \
--style compact 2>&1 \
| grep --line-buffered -i -E "DCP|Framebuffer|display|HPD|hotplug|disconnect|link|IOSurface|reconfigur|DPCD|unblank|blank|power.*state|timeout|error" \
| while IFS= read -r line; do
echo "$line" | tee -a "$LOG_FILE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment