#! /usr/bin/env bash # Creates macOS boot disk. printf "macOS Boot Disk Tips\n" printf " - Use a USB drive (8GB or higher).\n" printf " - Use Disk Utility to format the USB drive as \"Mac OS Extended (Journaled)\".\n" printf " - Use Disk Utility to label the USB drive as \"Untitled\".\n" printf "\nmacOS Boot Disk Usage:\n" printf " 1. Insert the USB boot disk into the machine to be upgraded.\n" printf " 2. Reboot the machine.\n" printf " 3. Hold the POWER (Silicon) or OPTION (Intel) key before the Apple logo appears.\n" printf " 4. Select the USB boot disk from the menu.\n" printf " 5. Use Disk Utility to delete and/or erase the hard drive including associated partitions.\n" printf " 6. Use Disk Utility to create a single \"APFS\" drive as a \"GUID Partition Table\".\n" printf " 7. Install the new operating system.\n" printf "\nmacOS Boot Disk Recovery:\n" printf " 1. Start/restart the machine.\n" printf " 2. Hold the POWER (Silicon) or COMMAND+R (Intel) keys before the Apple logo appears.\n" printf " 3. Wait for the macOS installer to load from the recovery partition.\n" printf " 4. Use the dialog options to launch Disk Utility, reinstall the system, etc.\n" printf "\nCreating macOS boot disk...\n" if [[ ! -e "$MAC_OS_BOOT_DISK_CREATOR" ]]; then printf "ERROR: macOS installer does not exist: $MAC_OS_BOOT_DISK_CREATOR. Use System Preferences → Software Update to download.\n" exit 1 fi if [[ ! -d "$MAC_OS_BOOT_DISK_PATH" ]]; then printf "ERROR: Boot disk must be mounted at: $MAC_OS_BOOT_DISK_PATH.\n" exit 1 fi sudo "$MAC_OS_BOOT_DISK_CREATOR" --volume "$MAC_OS_BOOT_DISK_PATH" --downloadassets --nointeraction