Skip to content

Instantly share code, notes, and snippets.

@niw
Last active October 23, 2024 03:20
Show Gist options
  • Save niw/1bac63d716f71555fa6bbda43ddfc504 to your computer and use it in GitHub Desktop.
Save niw/1bac63d716f71555fa6bbda43ddfc504 to your computer and use it in GitHub Desktop.
A script to download macOS install image and create an install disk image
#!/usr/bin/env bash
set -e
readonly INSTALL_APP_PATH="/Applications/Install macOS Mojave Beta.app"
if [[ -r "$INSTALL_APP_PATH/Contents/SharedSupport/InstallESD.dmg" ]]; then
echo "Found the install app, create an install disk image."
# Mojave install disk image requires about 7GB space.
hdiutil create -o untitled.dmg -size 7G -layout SPUD -fs HFS+J && \
hdiutil attach untitled.dmg
# Create an install disk image.
sudo "$INSTALL_APP_PATH/Contents/Resources/createinstallmedia" \
--volume /Volumes/untitled \
--downloadassets
else
echo "Enroll developer seed and open Mac App Store."
echo "You can unenroll after downloading the install app by next command:"
echo "sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil unenroll"
# Tell Mac App Store that we've enrolled `DeveloperSeed`.
# Actual `enroll` is needed to download a complete install image from Mac App Store.
#sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil enroll DeveloperSeed
# Probably this is not needed.
#/usr/libexec/PlistBuddy -c "clear dict" -c "add :SeedProgram string DeveloperSeed" /Users/Shared/.SeedEnrollment.plist
# Open Mac App Store to download macOS 10.14 Mojave.
/usr/bin/open macappstores://itunes.apple.com/app/id1354523149
fi
@norio-nomura
Copy link

norio-nomura commented Jun 14, 2019

Thank you for publishing this script!
It was necessary to add the option -volname $DISK_IMAGE_NAME to hdiutil create when using under conditions where the volume does not exist.

@niw
Copy link
Author

niw commented Jun 15, 2019

Ah, actually it's default to untitled but if not, it should given. Let me change it.

@mschultz-pro
Copy link

not sure if this will be useful to you but after the journey i went on to find them i wanted to share them with someone. here are the Bundle IDs for some MacOS non beta versions

com.apple.InstallAssistant.Catalina
com.apple.InstallAssistant.macOSVentura
com.apple.InstallAssistant.macOSBigSur
com.apple.InstallAssistant.macOSMonterey

i was able to find these based on what i read here https://pspdfkit.com/guides/ios/faq/finding-the-app-bundle-id/

@niw
Copy link
Author

niw commented Jun 10, 2023

On any recent new macOS, likely using softwareupdate command would be better solution to download installer. For example,

$ softwareupdate --list-full-installers
$ softwareupdate --fetch-full-installer --full-installer-version 14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment