Skip to content

Instantly share code, notes, and snippets.

@dongri
Created March 26, 2025 11:10
Show Gist options
  • Save dongri/c7957002f8a6c186cb5a30e7cb9ad96c to your computer and use it in GitHub Desktop.
Save dongri/c7957002f8a6c186cb5a30e7cb9ad96c to your computer and use it in GitHub Desktop.
reset_mac.sh
#!/bin/bash
echo "⚠️ 5秒後にディスクを完全に消去し、macOSを再インストールします。キャンセルするには Ctrl+C を押してください。"
sleep 5
# APFSでディスクを消去(ディスク番号は自動検出)
DISK_ID=$(diskutil list | grep "Apple SSD" | head -n 1 | awk '{print $NF}')
diskutil eraseDisk APFS "Macintosh HD" /dev/$DISK_ID
# macOS再インストール(Ventura の例)
"/Applications/Install macOS Ventura.app/Contents/Resources/startosinstall" \
--eraseinstall \
--agreetolicense \
--forcequitapps \
--nointeraction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment