geerlingguy / macos-virtualbox-vm

Instructions and script to help you create a VirtualBox VM running macOS.
MIT License
2.55k stars 314 forks source link

It doesn't work with Install macOS Mojave.app #60

Closed caiyesd closed 5 years ago

caiyesd commented 5 years ago

Here is the log


~/Downloads/macos-virtualbox-vm$ ./prepare-iso.sh "disk3" unmounted. "disk3" ejected. hdiutil: detach failed - No such file or directory

Mount the installer image

$ hdiutil attach /Applications/Install macOS Mojave.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app /dev/disk2 GUID_partition_scheme
/dev/disk2s1 EFI
/dev/disk2s2 Apple_HFS /Volumes/install_app

Create Mojave blank ISO image with a Single Partition - Apple Partition Map

$ hdiutil create -o /tmp/Mojave -size 8g -layout SPUD -fs HFS+J -type SPARSE created: /tmp/Mojave.sparseimage

Mount the sparse bundle for package addition

$ hdiutil attach /tmp/Mojave.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build /dev/disk3 Apple_partition_scheme
/dev/disk3s1 Apple_partition_map
/dev/disk3s2 Apple_HFS /Volumes/install_build

Restore the Base System into the Mojave ISO image

$ asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase Validating target...done Validating source... Could not recognize "/Volumes/install_app/BaseSystem.dmg" as an image file Could not validate source - Invalid argument

Remove Package link and replace with actual files

$ rm /Volumes/OS X Base System/System/Installation/Packages rm: /Volumes/OS X Base System/System/Installation/Packages: No such file or directory $ cp -rp /Volumes/install_app/Packages /Volumes/OS X Base System/System/Installation/ cp: /Volumes/OS X Base System/System/Installation: No such file or directory cp: /Volumes/install_app/Packages: unable to copy extended attributes to /Volumes/OS X Base System/System/Installation: No such file or directory cp: /Volumes/OS X Base System/System/Installation/Core.pkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/EmbeddedOSFirmware.pkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/FirmwareUpdate.pkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/OSInstall.mpkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/SecureBoot.pkg: No such file or directory cp: utimes: /Volumes/OS X Base System/System/Installation: No such file or directory cp: chown: /Volumes/OS X Base System/System/Installation: No such file or directory cp: chmod: /Volumes/OS X Base System/System/Installation: No such file or directory cp: chflags: /Volumes/OS X Base System/System/Installation: No such file or directory cp: /Volumes/install_app/Packages: unable to copy ACL to /Volumes/OS X Base System/System/Installation: No such file or directory

Copy macOS Mojave installer dependencies

$ cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS X Base System/BaseSystem.chunklist cp: /Volumes/install_app/BaseSystem.chunklist: No such file or directory $ cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS X Base System/BaseSystem.dmg cp: /Volumes/install_app/BaseSystem.dmg: No such file or directory

Unmount the installer image

$ hdiutil detach /Volumes/install_app "disk2" unmounted. "disk2" ejected.

Unmount the sparse bundle

$ hdiutil detach /Volumes/OS X Base System/ hdiutil: detach failed - No such file or directory

Resize the partition in the sparse bundle to remove any free space

$ hdiutil resize -size 221720b /tmp/Mojave.sparseimage hdiutil: resize: failed. Resource temporarily unavailable (35)

Convert the Mojave sparse bundle to ISO/CD master

$ hdiutil convert /tmp/Mojave.sparseimage -format UDTO -o /tmp/Mojave hdiutil: convert failed - Resource temporarily unavailable

Remove the sparse bundle

$ rm /tmp/Mojave.sparseimage

Rename the ISO and move it to the desktop

$ mv /tmp/Mojave.cdr /Users/jiangxin/Desktop/Mojave.iso mv: rename /tmp/Mojave.cdr to /Users/jiangxin/Desktop/Mojave.iso: No such file or directory

geerlingguy commented 5 years ago

See #53 and #56

eloops commented 4 years ago

What its tripping over, after the asr restore ... command, it's mounted the base system as /Volumes/macOS Base System and the script is trying to move packages into /Volumes/OS X Base System.

If you add an extra check against Mojave and change the ditto -V ... commands to point to the correct folder, the rest of the script will work.

Thanks for a great script that still works for creating ISO's.