hdiutil create -size 32g -type SPARSE -fs HFS+J -volname "Macintosh HD" ~/Desktop/mountainlion_12f37_user.sparseimage
hdiutil attach -owners on -noverify ~/Desktop/mountainlion_12f37_user.sparseimage
hdiutil attach -noverify /Applications/Install\ OS\ X\ Mountain\ Lion.app/Contents/SharedSupport/InstallESD.dmg
- Perform the Installation:
installer -pkg /Volumes/OS\ X\ Install\ ESD/Packages/OSInstall.mpkg -target /Volumes/Macintosh\ HD\ 1 -verboseR
- Eject the Installation Target:
hdiutil eject /Volumes/Macintosh\ HD\ 1
- Eject the Installation Media:
hdiutil eject /Volumes/OS\ X\ Install\ ESD
hdiutil convert -format UDZO ~/Desktop/mountainlion_12f37_user.sparseimage -o ~/Desktop/mountainlion_12f37_user.dmg
- Scan the image for restore:
asr imagescan --source ~/Desktop/mountainlion_12f37_user.dmg
rm -f ~/Desktop/mountainlion_12f37_user.sparseimage