Skip to content

Instantly share code, notes, and snippets.

@Diegus83
Last active February 9, 2024 14:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Diegus83/e493a30ac4d1c57e327fa181ce77294e to your computer and use it in GitHub Desktop.
Save Diegus83/e493a30ac4d1c57e327fa181ce77294e to your computer and use it in GitHub Desktop.
Makes one Bootable USB Lion installer from Apple's provided PKG (2021)
# This is not intended to be guide, I just wrote it as a reminder to myself of the steps necessary.
# If you find it useful, that's great, but keep in mind the paths and device ID's will need
# to be adjusted to your case. And you may need sudo if you are not doing this while booted from recovery like I did.
Get the InstallMacOSX.dmg from https://support.apple.com/kb/DL2077?locale=en_US
Mount the image
hdiutil mount InstallMacOSX.dmg
cd /Volumes/Install\ Mac\ OS\ X
Copy to a tmp location
mktemp -d
/var/folders/v6/s_rd76bx78j5mpjxl1b0yn5m0000gn/T/tmp.plAsi6ls
cp InstallMacOSX.pkg /var/folders/v6/s_rd76bx78j5mpjxl1b0yn5m0000gn/T/tmp.plAsi6ls/
cd /var/folders/v6/s_rd76bx78j5mpjxl1b0yn5m0000gn/T/tmp.plAsi6ls/
Change extension to xar
mv InstallMacOSX.pkg InstallMacOSX.xar
Unarchive
xar -xf InstallMacOSX.xar
Get the install media from the extracted package
mv InstallMacOSX.pkg/InstallESD.dmg .
Restore the install media to a USB drive (in this case /dev/disk4)
asr restore --source InstallESD.dmg --target /dev/disk4 --erase
@zhukovgreen
Copy link

zhukovgreen commented Feb 8, 2024

@Diegus83 I encountered Could not find any scan information. The source image needs to be imagescanned before it can be restored. problem while run command on macOS ventura. After some research, I found I can add -noverify parameter to asr for skipping this error.

asr restore --source InstallESD.dmg --target /dev/disk4 --erase -noverify

This helped. Just added sudo:

❯ sudo asr restore --source InstallESD.dmg --target /dev/disk4s1 --erase --noverify

@fanweixiao
Copy link

Thanks @zhukovgreen

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