# macOS 10.15 Catalina

# Create and mount a working image file
hdiutil create -o /tmp/tmp_iso.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/tmp_iso.cdr.dmg -noverify -mountpoint /Volumes/iso

#Restore from the original BaseSystem.dmg
asr restore -source /Applications/Install\ macOS\ Catalina.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/iso -noprompt -noverify -erase

# Unmount the mounted volume (because unmounting is required before covert. Note that the mount name of the restore destination has changed as a result of restoration)
hdiutil detach /Volumes/macOS\ Base\ System/

# Convert working image file to ISO image
hdiutil convert /tmp/tmp_iso.cdr.dmg -format UDTO -o /tmp/tmp_iso.iso

# Rename and save the ISO image
mv /tmp/tmp_iso.iso.cdr ~/Desktop/Catalina.iso

# Delete working image file
rm /tmp/tmp_iso.cdr.dmg