Skip to content

Instantly share code, notes, and snippets.

@aaronparker
Last active February 14, 2025 10:28
Show Gist options
  • Save aaronparker/c21cb93a774257e995777fb347e38e19 to your computer and use it in GitHub Desktop.
Save aaronparker/c21cb93a774257e995777fb347e38e19 to your computer and use it in GitHub Desktop.
Create a bootable USB drive with 13 macOS installers from Mountain Lion to Sequoia
#!/bin/zsh
# Create a bootable disk with multiple macOS installers
# Use at your own risk - this script is provided as-is and does not come with any warranty
# No error checking is performed and the script assumes the target disk is /dev/disk6
# https://github.com/aaronparker
# https://bsky.app/profile/stealthpuppy.com
# Partition and format the target disk - this is a 128GB disk
# Validate the target disk is /dev/disk6 before running - diskutil list
# The last partition will use the remaining space regardless of the size specified
diskutil partitionDisk /dev/disk6 14 GPT \
HFS+ 'Install OS X Mountain Lion' 4.65GB \
HFS+ 'Install OS X Mavericks' 6.25GB \
HFS+ 'Install OS X Yosemite' 5.95GB \
HFS+ 'Install OS X El Capitan' 6.5GB \
HFS+ 'Install macOS Sierra' 5.35GB \
HFS+ 'Install macOS High Sierra' 5.5GB \
HFS+ 'Install macOS Mojave' 6.3GB \
HFS+ 'Install macOS Catalina' 8.5GB \
HFS+ 'Install macOS Big Sur' 13.35GB \
HFS+ 'Install macOS Monterey' 13.85GB \
HFS+ 'Install macOS Ventura' 13.7GB \
HFS+ 'Install macOS Sonoma' 15.2GB \
HFS+ 'Install macOS Sequoia' 16.9GB \
APFS 'macOS Installers' 5GB
# Mount each ISO and copy the contents to the target disk
# Use Mist to download the installers: https://github.com/ninxsoft/Mist
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install OS X Mountain Lion 10.8.5_12F45.iso' -quiet
cp -R '/Volumes/Mac OS X Install ESD/' '/Volumes/Install OS X Mountain Lion'
cp '/Volumes/Mac OS X Install ESD/Install OS X Mountain Lion.app/Contents/Resources/ProductPageIcon.icns' '/Volumes/Install OS X Mountain Lion/.VolumeIcon.icns'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install OS X Mavericks 10.9.5.iso' -quiet
cp -R '/Volumes/OS X Base System/' '/Volumes/Install OS X Mavericks'
cp '/Volumes/Install OS X Mavericks/Install OS X Mavericks.app/Contents/Resources/ProductPageIcon.icns' '/Volumes/Install OS X Mavericks/.VolumeIcon.icns'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install OS X Yosemite 10.10.5_14F27.iso' -quiet
cp -R '/Volumes/Install OS X Yosemite 1/' '/Volumes/Install OS X Yosemite'
cp '/Volumes/Install OS X Yosemite/Install OS X Yosemite.app/Contents/Resources/ProductPageIcon.icns' '/Volumes/Install OS X Yosemite/.VolumeIcon.icns'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install OS X El Capitan 10.11.6_15G31.iso' -quiet
cp -R '/Volumes/Install OS X El Capitan 1/' '/Volumes/Install OS X El Capitan'
cp '/Volumes/Install OS X El Capitan/Install OS X El Capitan.app/Contents/Resources/ProductPageIcon.icns' '/Volumes/Install OS X El Capitan/.VolumeIcon.icns'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Sierra 10.12.6_16G29.iso' -quiet
cp -R '/Volumes/Install macOS Sierra 1/' '/Volumes/Install macOS Sierra'
cp '/Volumes/Install macOS Sierra/Install macOS Sierra.app/Contents/Resources/ProductPageIcon.icns' '/Volumes/Install macOS Sierra/.VolumeIcon.icns'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS High Sierra 10.13.6_17G66.iso' -quiet
cp -R '/Volumes/Install macOS High Sierra 1/' '/Volumes/Install macOS High Sierra'
cp '/Volumes/Install macOS High Sierra/Install macOS High Sierra.app/Contents/Resources/ProductPageIcon.icns' '/Volumes/Install macOS High Sierra/.VolumeIcon.icns'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Mojave 10.14.6_18G103.iso' -quiet
cp -R '/Volumes/Install macOS Mojave 1/' '/Volumes/Install macOS Mojave'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Catalina 10.15.7_19H15.iso' -quiet
cp -R '/Volumes/Install macOS Catalina 1/' '/Volumes/Install macOS Catalina'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Big Sur 11.7.10_20G1427.iso' -quiet
cp -R '/Volumes/Install macOS Big Sur 1/' '/Volumes/Install macOS Big Sur'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Monterey 12.7.4_21H1123.iso' -quiet
cp -R '/Volumes/Install macOS Monterey 1/' '/Volumes/Install macOS Monterey'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Ventura 13.7.3_22H417.iso' -quiet
cp -R '/Volumes/Install macOS Ventura 1/' '/Volumes/Install macOS Ventura'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Sonoma 14.7.3_23H417.iso' -quiet
cp -R '/Volumes/Install macOS Sonoma 1/' '/Volumes/Install macOS Sonoma'
hdiutil mount '/Volumes/ISOs/ISOs/Apple/Install macOS Sequoia 15.3_24D60.iso' -quiet
cp -R '/Volumes/Install macOS Sequoia 1/' '/Volumes/Install macOS Sequoia'
# Unmount all disk images
hdiutil info | grep "/dev/disk" | awk '{print $1}' | while read disk; do hdiutil detach $disk; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment