Simple script to create Mac OS installation .iso media

Preamble

It is supposed, that you downloaded it with App Store, and it is stored as .app in your /Applications directory.

Below is script. The only parameter you have to customize is a “DIST” variable, which should be your distributive name (“Mojave”, “Catalina” and so on).

This article is based on instructions from techsviewer.com

As a result you should get .iso file on your desktop with name of your distributive (e.g. “Catalina.iso”).

Script

create-macos-iso.sh

DIST=Mojave
DMG_FILE=/tmp/$DIST
DMG_FILE_EXT=/tmp/$DIST.dmg
VOL_NAME=/Volumes/$DIST
INSTALL_APP="Install macOS $DIST.app"
MEDIA_VOL="Install macOS $DIST"
CDR_FILE="$HOME/Desktop/$DIST.cdr"
ISO_FILE="$HOME/Desktop/$DIST.iso"

echo Create dmg... &&
hdiutil create -o $DMG_FILE -size 8500m -volname $VOL_NAME \
       -layout SPUD -fs HFS+J &&

echo Attach dmg... &&
hdiutil attach $DMG_FILE_EXT -noverify -mountpoint $VOL_NAME &&

echo Create install media... &&
sudo /Applications/"$INSTALL_APP"/Contents/Resources/createinstallmedia \
    --volume $VOL_NAME --nointeraction &&

echo Detach $MEDIA_VOL... &&
hdiutil detach /Volumes/"$MEDIA_VOL" &&

echo Convert $DMG_FILE_EXT -\> $CDR_FILE &&
hdiutil convert $DMG_FILE_EXT -format UDTO -o $CDR_FILE &&

echo Rename $CDR_FILE -\> $ISO_FILE &&
mv $CDR_FILE $ISO_FILE &&

echo Cleanup... &&
rm $DMG_FILE_EXT
Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *