WARNING: The script will work with OSX ≥ 10.12.4, but VirtualBox will *not* boot from such an ISO for reasons yet unknown. There is a bug report open for that: #16644: Installation of clean OSX 10.12.4 fails. If you have any idea on how to make this work, I'd appreciate a comment.
With OSX 10.9 (Mavericks) Apple started distributing the OSX installer as a standalone application, with instructions on how to create bootable USB sticks if needed. The problem is that this is not ideal for users of VirtualBox who wanted to install a clean VM from scratch, or (until VirtualBox 5.1) could not boot their VM from a bootable USB.
There are two parts in this tutorial: 1) OSX 10.9 up to 10.12, and 2) OSX 10.13.
Part 1: OSX 10.9 up to 10.12
"InstallerApp2ISO.sh" creates an ISO file from the various OSX installer applications that Apple distributes (freely) to existing OSX users:
- This is my first attempt at bash scripting, so please go easy on me. If you have any suggestions, feel free (if not obliged) to share your thoughts.
- If you encounter an error, re-run the script with the extra verbose option "-v 3", copy the whole Terminal output and post it here with as many details as possible (besides the output that is).
- The script is not portable, as it uses some OSX only options. It could be, but it would miss all the ... special effects.
- You'll need 15 GB of free space for that. Most of the time less, but let's be conservative. And if you don't have 15 GB available, the script is the least of your problems.
- The script covers versions 10.9.x (Mavericks), 10.10.x (Yosemite), 10.11.x (El Capitan) and 10.12.x (Sierra).
- The script will leave you with an ISO image named "10.#(.#).iso", where # is... well, you can guess.
- The script does not need administrator access. You don't need to be using "sudo" or being logged in as administrator.
INSTRUCTIONS
- Save the zip file, unzip it and run "InstallerApp2ISO.sh" from the Terminal:
================================================================================
Apple OSX Installer Application to ISO creation tool
================================================================================
Version: 2017-07-18
Copyright (C) 2017, socratis @ VirtualBox forums.
All rights reserved.
*** ERROR: No arguments specified. The --installer option is mandatory.
Usage:
InstallerApp2ISO -i|--installer <InstallerApp>
[-o|--output <OutputDir>]
[-t|--tmpdir <TempDir>]
[-v|--verbose <VerboseLevel>]
[-d|--dry-run]
[-x|--OSX <OSXVersion>]
[-c|--checksum]
[-r|--revision]
[-h|-?|--help]
-i|--installer The full path of the InstallerApp. *** MANDATORY ***
-o|--output The directory where the resulting ISO will be created.
The name will be 10.x.y.iso. Default is your desktop.
The directory will be checked for free space availability.
-t|--tmpdir If you are running low on space, you can provide an
alternative temporary/scratch directory. The directory
will be checked for free space availability.
*******************************************************
***** DO NOT CHOOSE A NETWORK TEMPORARY DIRECTORY *****
*******************************************************
-v|--verbose Some OSX commands support --verbose and --quiet options.
In addition, the verbose level can control whether the
the commands are printed before they are executed:
0: Set the quiet flag in OSX. Commands are not printed.
1: Set no flags in OSX. Commands are not printed. DEFAULT.
2: Set no flags in OSX. Commands are printed.
3: Set the verbose flag in OSX. Commands are printed.
-d|--dry-run Doesn't actually run the scripts, simply output the
commands that would be used with the given parameters.
-x|--OSX OSXVersion can be one of: 10.9, 10.10, 10.11 or 10.12.
You should use it in case that the OSX version cannot
be determined automatically, or you're running a dry run.
-c|--checksum Compare the output of the generated ISO with a list of
known checksums. Optional, but useful.
-r|--revision Print the revision history of the script.
-h|-?|--help Print this help message.
KNOWN ISSUES
- A network temporary directory will corrupt your ISO. I've been trying to figure out why, to no avail. I'm planning on including a check on whether the temporary directory is on a network volume or not.
- The checksum option is not working as expected. This is the most baffling part in the behavior of the script. You have a script that does the exact same thing, time after time after time. Yet the checksum at the end is like you're generating a random hex number. No clue why it doesn't work.
- Error checking ranges from non existent to not at all. I mean it will definitely fail in the first error encounter, I simply don't do any error redirection/logging.
RELEASES
2017-07-25
- When using the dry-run it doesn't check for anything anymore. Not the existence of the installer nor the available free space.
- Trimming of the free space from the sparsebundle is back.
- Fixed an issue where if the destination volume contained a space, the calculation for the amount of free space generated an error.
- Fixed inconsistencies in ISO vs iso.
- Updated to cover OSX 10.12.5 (16F73).
- Fixed verbosity flags for some cases.
- Updated to cover OSX 10.12.4 (16E195).
- The '--OSX' flag was ignored if the '--dry-run' was not set as well. Now you can use future OSX updates even if the script doesn't cover them.
- Fixed a cosmetic error if the verbose level was set to 2 or 3.
- Fixed a cosmetic error by closing the 'OSX Base System' window.
- Added version and revision information.
- Initial release. Unified pretty much the scripts for different versions of the InstallerApps. Added a few options here and there.
Part 2: OSX 10.13
- Download "Install macOS High Sierra.app" from Apple. By default it will be placed in the "/Applications" folder. If the upgrade starts, cancel out.
- Run the script below as an Administrator, courtesy of https://tylermade.net/2017/10/05/how-to ... installer/
hdiutil create -o /tmp/10.13.x.cdr -size 5530m -layout SPUD -fs HFS+J
hdiutil attach /tmp/10.13.x.cdr.dmg -noverify -mountpoint /Volumes/1013_install
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/1013_install
mv /tmp/10.13.x.cdr.dmg /Users/Shared/10.13.x.dmg
hdiutil detach /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert /Users/Shared/10.13.x.dmg -format UDTO -o /Users/Shared/10.13.x
rm /Users/Shared/10.13.x.dmg
mv /Users/Shared/10.13.x.cdr /Users/Shared/10.13.x.iso
Installing OSX 10.13 is not a straight forward process, so I'll cover it in another article, "[HowTo] Install OSX 10.13 in a VM".