(Hat tip: User toru173 at MacRumors)
For the last couple of macOS versions, it has been standard to upgrade the system from a downloaded package, or to create an installation USB drive. However, you may find that CDs are easier to store as backups, and thus want to create an old-fashioned CD installer. This article will show how to do this with the High Sierra version of macOS. Most of the instructions here require that you use the Terminal to enter commands.
First, you must download the High Sierra package from the Mac App Store. This will create a directory called "Install macOS High Sierra" under Applications. On some systems, only a small stub of about 19MB is downloaded. It can appear random which systems that receive the full installation package and which only get the stub. If you got the stub, then you must run the program, accept the license and pick a target volume. Then it will start downloading the full version. When you get to the final screen, do NOT click the Reset button, but rather select Quit from the application menu at the top of the screen.
The bulk of the downloaded files is put directly in an auxiliary directory in the root of the volume you selected in the installer. To create a bootable installer, these files must be available from within the installer directory, to be copied from there. This is best done by moving the files back into the required subdirectory. You should move the entire top directory instead of copying the files underneath it, because there are locked files which you ordinary user cannot access.
mv "/macOS Install Data" "/Applications/Install macOS High Sierra.app/Contents/SharedSupport"
Create an image file with sufficient space to hold the DVD, in a format that is writable and growable, and mount it. Please make sure that you don't have any other disks named Untitled currently in use.
hdiutil create -o /tmp/HighSierra -size 12800m -layout SPUD -fs HFS+J -type SPARSE hdiutil attach /tmp/HighSierra.sparseimage -noverify -nobrowse -mountpoint /Volumes/Untitled
Now create a bootable image from the mini-system that is embedded in the installer.
caffeinate asr restore -source "/Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg" -target /Volumes/Untitled -noprompt -noverify -erase
This will change the name of the volume from
OS X Base System,
to reflect the setting in the source image.
Copying must be done as the superuser since it contains locked files that the normal user does not have access to.
sudo rm -rf "/Volumes/OS X Base System/Install macOS High Sierra.app" caffeinate sudo cp -a "/Applications/Install macOS High Sierra.app" "/Volumes/OS X Base System/"
Give the CD a proper icon.
cp "/Applications/Install macOS High Sierra.app/Contents/Resources/InstallAssistant.icns" "/Volumes/OS X Base System/.VolumeIcon.icns" SetFile -a C "/Volumes/OS X Base System/"
Rename the installer volume.
diskutil rename "OS X Base System" "Install macOS High Sierra"
We are done with putting files into the installer image. Unmount the filesystem within so that we can start to work on the image file itself.
hdiutil detach "/Volumes/Install macOS High Sierra"
Shrink the image to the minimum size possible, and convert it into an ISO format file that can be written to a physical disk.
hdiutil resize -size min /tmp/HighSierra.sparseimage caffeinate hdiutil convert /tmp/HighSierra.sparseimage -format UDTO -o /tmp/HighSierra mv /tmp/HighSierra.cdr /tmp/HighSierra.iso
Now the installation CD is ready, and can be burnt to a physical CD.
There is a a caveat when using this CD: You must boot from the CD first, then run through the installer. When the installer reboots, you must start from the CD again, but this time, don't run the installer but rather a start a Terminal from the Utilities menu at the top of the screen. Here we must supply the installation package that this version of the installer thinks is already copied to disk.
cp "/Volumes/Install macOS High Sierra/Install macOS High Sierra.app/Contents/SharedSupport/InstallESDDmg.pkg" "/Volumes/Macintosh HD/macOS Install Data/"
Finally, while you still have a functional version of the system booted, you should run a
disk check. If this fails when the system reboots, you are effectively hosed, whereas at
this point, being in the installer, you can still rescue files to an external disk.
Assuming that your harddisk is called
Macintosh HD and that this is the second
s2) on the first harddisk (
rdisk0), the commands to run
hdiutil detach "/Volumes/Macintosh HD" fsck_hfs -fy -x /dev/rdisk0s2