Skip to content

Instantly share code, notes, and snippets.

@agentsim
Created June 10, 2017 02:23
Show Gist options
  • Save agentsim/00cc38c693e7d0e1b36a2080870d955b to your computer and use it in GitHub Desktop.
Save agentsim/00cc38c693e7d0e1b36a2080870d955b to your computer and use it in GitHub Desktop.
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
# Restore the 10.13 Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
hdiutil create -o /tmp/HighSierra.cdr -size 8965m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp /tmp/BaseSystem.dmg /Volumes/OS\ X\ Base\ System
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso
mv /tmp/HighSierra.iso.cdr ~/Desktop/HighSierra.iso
rm /tmp/HighSierra.cdr.dmg
@mykola87
Copy link

mykola87 commented Oct 6, 2017

when I run the script (edited for the final release) it fails on line 6.
I ran each line separately in Terminal. I even re-downloaded the installation file just in case. The error I receive is:
Mac:~ username$ cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation cp: /Volumes/OS X Base System/System/Installation/Packages: File exists cp: /Volumes/highsierra/Packages: unable to copy extended attributes to /Volumes/OS X Base System/System/Installation/Packages: No such file or directory cp: /Volumes/OS X Base System/System/Installation/Packages/Core.pkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/Packages/EmbeddedOSFirmware.pkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/Packages/FirmwareUpdate.pkg: No such file or directory cp: /Volumes/OS X Base System/System/Installation/Packages/OSInstall.mpkg: No such file or directory
Any idea why this happens ?
running this in an existing vmware install of macOS High Sierra

@Ezerbeth
Copy link

Doesn't work for me. The "cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation" part just errors out with 10 different errors, so it's impossible to continue.

Easy answer to this: use createinstallmedia from the official image and then rip your USB/DVD device to ISO. Two steps required and it just works. Nice script tho.

@dschense
Copy link

For me everything is working fine! got a working .iso and installed this on vbox on manjaro rolling release. Nice setup to play with ;)

@edvardkniazev
Copy link

@agentsum, @satmandu, @umetzu, @vbosx Thank you very much! Everything worked perfectly for me!

@schnabelewobski
Copy link

Be aware that the disk size may have to be adjusted. 5130m didn't work for me, but 5300m did.

@pat-s
Copy link

pat-s commented Nov 19, 2017

This worked for me using an increased size for the base image. Thanks to all contributers!

hdiutil create -o /tmp/HighSierra.cdr -size 5500m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/HighSierra.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/HighSierra.iso

@mcandre
Copy link

mcandre commented Nov 26, 2017

Just noting here that createinstallmedia often yields a broken disk image, that makes VirtualBox get stuck in UEFI shell. Rerunning the createinstallmedia step eventually fixes this problem. And yeah, using at least 5500MB for the image also helps. :/

@singhsays
Copy link

pat-s's recipe worked perfectly for me.

@zapinguete
Copy link

pat-s, hat off 2 you

@Candunc
Copy link

Candunc commented Dec 5, 2017

If you get stuck at the UEFI Shell, there is a workaround. Type the following in:

Shell> fs1:
FS1:> cd "macOS Install Data"
FS1:\macOS Install Data> cd "Locked Files"
FS1:\macOS Install Data\Locked Files> cd "Boot Files"
FS1:\macOS Install Data\Locked Files\Boot Files> boot.efi

From this github comment which credits https://raimue.blog/2017/06/09/upgrading-a-vm-from-macos-10-12-sierra-to-macos-10-13-high-sierra-in-virtualbox/

@stylemessiah
Copy link

I tried pats's steps and when issuing "sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build" i get the following:

Erasing Disk: 0%... 10%...
Error erasing disk error number (1, 0)
A error occurred erasing the disk.

Any ideas?

@nonusoft
Copy link

@sovcharenko
Copy link

@stylemessiah, I had the same issue. I wasn't able to quickly find a reasonable explanation/fix. Instead I created dmg using disk utility (File -> New Image -> Blank Image, Size 6000 Mb, Format Mac OS Extended Journaled, Single partition - GUID Partition Map, read/write) and it worked just fine.

@mwiesen
Copy link

mwiesen commented Dec 26, 2017

On MacOS 10.13.2: If you get a Failed to copy kernelcache, “prelinkedkernel” couldn’t be copied to “.IABootFiles”. Error during the createinstallmedia step, increasing the size of the image to 5530m worked for me. In the end, the steps that did the job for me were:

hdiutil create -o /tmp/HighSierra.cdr -size 5530m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/HighSierra.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/HighSierra.iso
mv ~/Desktop/HighSierra.iso.cdr ~/Desktop/HighSierra.iso
rm ~/Desktop/InstallSystem.dmg

@gerrior
Copy link

gerrior commented Jan 28, 2018

On MacOS 10.13.3: mwiesen's script in the prior comment still works. FWIW, I couldn't get that script to work on a prior beta of High Sierra but using production 10.13.2 worked - call to createinstallmedia failed.

@Marioheld
Copy link

@mwiesen Did also worked for me. Thanks a lot for sharing. Also be sure that the whole /Applications/Install\ macOS\ High\ Sierra.app is downloaded. The first time I tried to download High Sierre the App only was about 50 MB big, only contained the installer for upgrading on the fly not the whole High Sierra Image. Should be around 5 GB big.

@qre0ct
Copy link

qre0ct commented Feb 2, 2018

I tried following all the steps listed above by @umetzu as below to create an ISO of High Sierra:

hdiutil attach /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
Restore the 10.13 Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
hdiutil create -o /tmp/HighSierra.cdr -size 8965m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp /tmp/BaseSystem.dmg /Volumes/OS\ X\ Base\ System
hdiutil detach /Volumes/OS\ X\ Base\ System/
rm /tmp/BaseSystem.dmg
hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso
mv /tmp/HighSierra.iso.cdr ~/Desktop/HighSierra.iso
rm /tmp/HighSierra.cdr.dmg

And got a bunch of errors on the line cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation. But nevertheless I continued and it seemed to work fine. Finally an .iso was created on my Desktop.

However, when I tried using it to install it in VirtualBox (Version 5.2.6 r120293 (Qt5.6.3) it seems to get stuck, as shown in the image forever. Any suggestions guys ?

@rct
Copy link

rct commented Feb 4, 2018

When I try to follow @mwiesen steps from the Dec 26, 2017 comment, I hit the problem where creatinstallmedia fails trying to erase /Volumes/install_build. I get the same error as @stylemessiah:

$ sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
Password:
Ready to start.
To continue we need to erase the volume at /Volumes/install_build.
If you wish to continue type (Y) then press return: y
Erasing Disk: 0%... 10%...
Error erasing disk error number (22, 0)
A error occurred erasing the disk.

I'm trying to run this on 10.12.6 (Sierra). I haven't run the upgrade yet. The download in /Applications/Install macOS High Sierra.app looks ok, it is 4.9 GB, (4,968 MB). If I run createinstallmedia using a physical 8 GB USB thumb drive it succeeds.

@stylemessiah - were you able to figure it out?

Any ideas from anyone welcome.

Copy link

ghost commented Feb 8, 2018

@rct It is caused by permission mismatch. Remember, if you use 'sudo' you are executing the command as a root user, therefore created file will be owned by root. Solution is to be consistent with sudo. If you create file as a root, mount it as a root. If you create it as normal user, mount it as normal user.

@Kuniwak
Copy link

Kuniwak commented Apr 13, 2018

I got the same error that mentioned by @stylemessiah and @rct.

I retried the same instructions after increased the size of image from 7136m to 8000m. It worked for me.

@mddelfino
Copy link

Made a fork of this code. If you use it, edit the VARIABLES section to meet your needs. I sorted them in order of what I thought might most likely need editing for your environment. Happy Independence Day, USA people!

@reflectivist
Copy link

reflectivist commented Aug 22, 2018

As of today, I was able to a successfully boot and launch the High Sierra installer from an ISO image that I converted from the High Sierra 10.13.6 installer that I downloaded from the Apple Store (converted using Pat's Nov. 2017 instructions above). The installer is running in a Virtual Machine (guest) under VirtualBox 5.2.19, running on a Late 2015 iMac (Retina) host.

I used following VirtualBox Virtual Machine configuration values (settings):

4096 GB RAM
32 GB disk size (VDI)
128 MB video RAM
2 CPUs
disabled floppy
disabled serial port
disabled audio

Additionally, from the command line had to create the following Virtual Box extra data values for the VM. NOTE: These seemed to be critical for me to get the installer to boot and run. These extra data settings I found to be omitted from most or all of the Mac installation instructions that I found online. I borrowed these values from Windows VirtualBox install instructions, and modified the system product to match my iMac's (iMac17,1). Without these extra data settings, the installer failed mid-boot, infinitely looping with some error pertaining to trying to reboot MACH).

VBoxManage setextradata "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac17,1"
VBoxManage setextradata "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Finally, when the installer came up, before attempting to install, I had to select Disk Utility from the list, and find and format (e.g. Erase), the VDI disk I created (the hard disk shown on the left) as Mac OS Extended Journaled. Without first formatting the disk, the installer found no disks upon which it could install macOS, and was a dead end.

@TCB13
Copy link

TCB13 commented Aug 28, 2018

Many thanks @pat-s !

For anyone wondering if it is possible to install this ISO into VMware Workstation under a Windows machine, follow this: https://github.com/DrDonk/unlocker .

Note: it may give you an error like VMware Workstation unrecoverable error: (vcpu-0) simply edit your .vmx file and add smc.version = "0".

@TCB13
Copy link

TCB13 commented Sep 26, 2018

For anyone having No such file or directory run this before the cp command:

rm -rf /Volumes/OS\ X\ Base\ System/System/Installation/Packages
mkdir -p /Volumes/OS\ X\ Base\ System/System/Installation/Packages

Looks like Apple places a link on /Volumes/OS\ X\ Base\ System/System/Installation/Packages. In order to copy the required packages, we need to remove the link and then recreate the folder.

I tested the final image and everything works fine.

@maxmalta
Copy link

If you have Catalina installed, use this tutorial:

## Create a HighSierra.ISO using Mac OS Catalina
#################################################

# 1- Create volume (You need to put HighSierra Installer downloaded from AppStore in Applications)
hdiutil create -o /tmp/HighSierra -size 5400m -volname HighSierra -layout SPUD -fs HFS+J
# If sucessful, you will see: created: /tmp/HighSierra.dmg

# 2- Mount new volume created
hdiutil attach /tmp/HighSierra.dmg -noverify -mountpoint /Volumes/HighSierra
# If sucessful, you will see:
# /dev/disk3 Apple_partition_scheme
# /dev/disk3s1 Apple_partition_map
# /dev/disk3s2 Apple_HFS /Volumes/HighSierra

# 3- Erase new volume (It's necessary on the Catalina OS) => replace disk3 with correct disk#, use Disktools or diskutil list on terminal for you get correct #.
diskutil eraseDisk JHFS+ HighSierra disk3
# If sucessful, you will see:
# Started erase on disk3
# Unmounting disk
# Creating the partition map
# Waiting for partitions to activate
# Formatting disk3s2 as Mac OS Extended (Journaled) with name HighSierra
# Initialized /dev/rdisk3s2 as a 5 GB case-insensitive HFS Plus volume with a 8192k journal
# Mounting disk
# Finished erase on disk3

# 4- Copy Content to new volume
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/HighSierra --nointeraction
# If sucessful, you will see:
# Password:
# Erasing Disk: 0%... 10%... 20%... 30%...100%...
# Copying installer files to disk...
# Copy complete.
# Making disk bootable...
# Copying boot files...
# Copy complete.
# Done.

# 5- Unmount Volume
hdiutil detach /volumes/Install\ macOS\ High\ Sierra/
# If sucessful, you will see: "disk3" ejected.

# 6- Convert to iso
hdiutil convert /tmp/HighSierra.dmg -format UDTO -o ~/Desktop/HighSierra.iso
# If sucessful, you will see:
# Lendo Protective Master Boot Record (MBR : 0)…
# Reading GPT Header (Primary GPT Header : 1)…
# Reading GPT Partition Data (Primary GPT Table : 2)…
# Reading (Apple_Free : 3)…
# Reading EFI System Partition (C12A7328-F81F-11D2-BA4B-00A0C93EC93B : 4)…
# ...
# Reading Untitled 2 (Apple_HFS : 5)…
.............................................................................
# Reading (Apple_Free : 6)…
# Reading GPT Partition Data (Backup GPT Table : 7)…
# .............................................................................
# Reading GPT Header (Backup GPT Header : 8)…
# .............................................................................
# Time: 39.527s
# Speed: 136.6Mbytes/seg
# Saving: 0.0%
# created: /Users/max/Desktop/HighSierra.iso.cdr

# 7- Rename HighSierra.iso.cdr to HighSierra.iso

@maxmalta
Copy link

I tried pats's steps and when issuing "sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build" i get the following:

Erasing Disk: 0%... 10%...
Error erasing disk error number (1, 0)
A error occurred erasing the disk.

Any ideas?

See my post for using Catalina

@jamesiter
Copy link

When I try to follow @mwiesen steps from the Dec 26, 2017 comment, I hit the problem where creatinstallmedia fails trying to erase /Volumes/install_build. I get the same error as @stylemessiah:

$ sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
Password:
Ready to start.
To continue we need to erase the volume at /Volumes/install_build.
If you wish to continue type (Y) then press return: y
Erasing Disk: 0%... 10%...
Error erasing disk error number (22, 0)
A error occurred erasing the disk.

I'm trying to run this on 10.12.6 (Sierra). I haven't run the upgrade yet. The download in /Applications/Install macOS High Sierra.app looks ok, it is 4.9 GB, (4,968 MB). If I run createinstallmedia using a physical 8 GB USB thumb drive it succeeds.

@stylemessiah - were you able to figure it out?

Any ideas from anyone welcome.

Use "disk utility" to erase & format the /tmp/Catalina.dmg.

@learninMuchSo
Copy link

Wow thank you so much @maxmalta i've been trying from yesterday night to get an iso for high sierra and yours was clear, concise and worked perfectly! Thank you very much.

@learninMuchSo
Copy link

Guys if you are using catalina @maxmalta 's solution is the one to go to.

@RudraSen2
Copy link

Generate ISO (New Method) Requires macOS Catalina+:

softwareupdate --fetch-full-installer --full-installer-version 10.13.6
sudo hdiutil create -o /tmp/HighSierra -size 16384m -volname HighSierra -layout SPUD -fs HFS+J
sudo hdiutil attach /tmp/HighSierra.dmg -noverify -mountpoint /Volumes/HighSierra
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/HighSierra --nointeraction
hdiutil eject -force /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert /tmp/HighSierra.dmg -format UDTO -o ~/Desktop/HighSierra
mv -v ~/Desktop/HighSierra.cdr ~/Desktop/HighSierra.iso
sudo rm -fv /tmp/HighSierra.dmg

You should end up with a High Sierra ISO File in your Desktop

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