Technology
solutions
for you

Creative IT
http://GetCreativeIT.com

10445 SW Canyon Rd, Suite 111-B
Beaverton, Oregon 97005
+1 (970) 303-5590

How to create a bootable macOS ISO for virtualization

Purpose

If your are a developer, system administrator or enthusiast, you will soon find advantages to virtualizing an instance of the macOS. For developers you will want to maintain the integrity of your host OS for your normal business tasks, but will need to setup an environment for developing and testing. If you are a system administrator you probably wish to build a virtual macOS server. The standard way to install a desired OS into a virtual environment is by using a bootable ISO of that OS. Apple does not provide an ISO for their current macOS, but they do provide a macOS installer application. These instructions will show you how to build a bootable macOS ISO from Apple’s macOS installer application.

Prerequisites

The latest version of macOS installer application for your desired OS, which currently can be download from Apple’s App Store.

Solution

  1. At the Finder from the File menu select New Finder Window
  2. Navigate to Applications > Utilities and double-click on Terminal
  3. In the Terminal type the following commands:
    1. hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/OS\ X\ Install\ ESD
    2. hdiutil create -o ~/Desktop/macOS_10.12.2 -size 8192m -type SPARSE -fs HFS+J -layout SPUD (x represents the version number i.e. 10.12.2)
    3. hdiutil attach ~/Desktop/macOS_10.12.2.sparseimage -noverify -nobrowse -mountpoint /Volumes/macOS_10.12.2
    4. asr restore -source /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg -target /Volumes/macOS_10.12.2 -erase -noprompt -noverify
    5. At this point a Finder window will pop-up, so click on its red close button. In the Terminal continue typing:
    6. rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
    7. cp -rp /Volumes/OS\ X\ Install\ ESD/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
    8. cp -rp /Volumes/OS\ X\ Install\ ESD/BaseSystem.* /Volumes/OS\ X\ Base\ System/
    9. hdiutil detach /Volumes/OS\ X\ Install\ ESD
    10. hdiutil detach /Volumes/OS\ X\ Base\ System
    11. hdiutil resize -size `hdiutil resize -limits ~/Desktop/macOS_10.12.2.sparseimage | tail -n 1 | awk '{ print $1 }'`b ~/Desktop/macOS_10.12.2.sparseimage
    12. hdiutil convert ~/Desktop/macOS_10.12.2.sparseimage -format UDTO -o ~/Desktop/macOS_10.12.2
    13. mv ~/Desktop/macOS_10.12.2.cdr ~/Desktop/macOS_10.12.2.iso
    14. rm ~/Desktop/macOS_10.12.2.sparseimage