Creating a macOS 10.14 Mojave installation ISO

By | September 28, 2018

I previously wrote up my version of creating a macOS High Sierra ISO HERE.

NOTE: This is now broken! Please read the comments by others below. I’ll try to update this at a future time, and create a new clean one for Catalina as well! THANK YOU ALL!

For Mojave there’s a fix that needed to be applied (delete a bad hard link on the image, replace with a directory) but otherwise it works. I also changed it to use your CURRENT DIRECTORY as the working directory. So do this on your fastest disk (SSD hopefully).

First, download Mojave from the App Store and then cancel the installation after it starts (Command-Q). This will leave the “Install macOS Mojave” installer in your /Applications folder.

Then copy this code and save it as a shell script named “mk-mojave-iso.sh”

#!/usr/bin/env bash
hdiutil attach /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/mojave
hdiutil create -o ./MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach ./MojaveBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm -rf /Volumes/OS\ X\ Base\ System/System/Installation/Packages
mkdir -p /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -R /Volumes/mojave/Packages/* /Volumes/OS\ X\ Base\ System/System/Installation/Packages/
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/mojave/
mv ./MojaveBase.cdr.dmg ./BaseSystem.dmg
# Restore the 10.13 Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
hdiutil create -o ./Mojave.cdr -size 8965m -layout SPUD -fs HFS+J
hdiutil attach ./Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp ./BaseSystem.dmg /Volumes/OS\ X\ Base\ System
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil convert ./Mojave.cdr.dmg -format UDTO -o ./Mojave.iso
mv ./Mojave.iso.cdr ~/Desktop/Mojave.iso
rm ./Mojave.cdr.dmg

Run the code from a clean working directory on a fast SSD. The output will contain a few errors highlighted below but you can ignore them:

➜ mojave ./mk-mojave-iso.sh
/dev/disk5 GUID_partition_scheme
/dev/disk5s1 EFI
/dev/disk5s2 Apple_HFS /Volumes/mojave
created: /Volumes/Data/mojave/MojaveBase.cdr.dmg
/dev/disk6 Apple_partition_scheme
/dev/disk6s1 Apple_partition_map
/dev/disk6s2 Apple_HFS /Volumes/install_build
Validating target...done
Validating source...done
Retrieving scan information...done
Validating sizes...done
Restoring ....10....20....30....40....50....60....70....80....90....100
Restored target device is /dev/disk6s2.
Remounting target volume...done
Personalization succeeded
asr: Couldn't personalize volume /Volumes/OS X Base System
"disk6" ejected.
"disk5" ejected.
created: /Volumes/Data/mojave/Mojave.cdr.dmg
/dev/disk5 Apple_partition_scheme
/dev/disk5s1 Apple_partition_map
/dev/disk5s2 Apple_HFS /Volumes/install_build
Validating target...done
Validating source...done
Retrieving scan information...done
Validating sizes...done
Restoring ....10....20....30....40....50....60....70....80....90....100
Restored target device is /dev/disk5s2.
Remounting target volume...done
Personalization succeeded
asr: Couldn't personalize volume /Volumes/OS X Base System
"disk5" ejected.
Reading Driver Descriptor Map (DDM : 0)…
Reading Apple (Apple_partition_map : 1)…
Reading disk image (Apple_HFS : 2)…
......................................................................................................................................................................
Elapsed Time: 1m 6.068s
Speed: 135.7Mbytes/sec
Savings: 0.0%
created: /Volumes/Data/mojave/Mojave.iso.cdr

The ISO will be in your working directory.

Best not to do this on your Desktop or Documents folder if you use iCloud Drive, as it will try to move several GB up to iCloud as soon as you are done.

Category: How-To Tags:

About Bill Plein

I've been in the data storage industry since the 1990's, most recently with 3PAR, Fusion-io, and Pure Storage. I'm now with Diamanti, where we make Kubernetes easy and fast. I'm attracted to bright, shiny new objects.

13 thoughts on “Creating a macOS 10.14 Mojave installation ISO

  1. stevenckwong

    thank you! after searching through endless posts, i finally found one that works here! thank you very very much!

  2. Nameless66

    For OSX 10.14.4 you have to replace

    /Volumes/OS\ X\ Base\ System/

    by

    /Volumes/macOS\ Base\ System/

    Be careful with the trailing slash! Sometimes you nee it sometimes not

    Here is the corrected shell-script:

    #!/usr/bin/env bash
    hdiutil attach /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/mojave
    hdiutil create -o ./MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J
    hdiutil attach ./MojaveBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    rm -rf /Volumes/macOS\ Base\ System/Installation/Packages
    mkdir -p /Volumes/macOS\ Base\ System/Installation/Packages
    cp -R /Volumes/mojave/Packages/* /Volumes/macOS\ Base\ System/Installation/Packages/
    hdiutil detach /Volumes/macOS\ Base\ System
    hdiutil detach /Volumes/mojave/
    mv ./MojaveBase.cdr.dmg ./BaseSystem.dmg
    # Restore the 10.13 Installer’s BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
    hdiutil create -o ./Mojave.cdr -size 8965m -layout SPUD -fs HFS+J
    hdiutil attach ./Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    cp ./BaseSystem.dmg /Volumes/macOS\ Base\ System
    hdiutil detach /Volumes/macOS\ Base\ System
    hdiutil convert ./Mojave.cdr.dmg -format UDTO -o ./Mojave.iso
    mv ./Mojave.iso.cdr ~/Desktop/Mojave.iso
    rm ./Mojave.cdr.dmg

  3. Kevin White

    Note: I tried this with Mojave 10.14.5 and found that the name the image mounts itself under /Volumes has changed. The script refers to /Volumes/OS\ X\ Base\ System/ in several places. I had to change that to /Volumes/macOS\ Base\ System/ everywhere to make the script work.

  4. Joey

    In either 10.14.4 or 10.14.5, Apple changed the mount point for the BaseSystem.dmg from ‘OS X Base System’ to ‘macOS Base System’.

    To make this script work again, I just did a search and replace.

  5. Jeans

    It’s work. Thank you very much.

    Following is update for 10.14.5 (updated 28 May 2019 at 06:00)

    #!/usr/bin/env bash
    hdiutil attach /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/mojave
    hdiutil create -o ./MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J
    hdiutil attach ./MojaveBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

    # Change from “/Volumes/OS\ X\ Base\ System” to “/Volumes/macOS\ Base\ System”
    rm -rf /Volumes/macOS\ Base\ System/System/Installation/Packages
    mkdir -p /Volumes/macOS\ Base\ System/System/Installation/Packages
    cp -R /Volumes/mojave/Packages/* /Volumes/macOS\ Base\ System/System/Installation/Packages
    hdiutil detach /Volumes/macOS\ Base\ System/
    hdiutil detach /Volumes/mojave/
    mv ./MojaveBase.cdr.dmg ./BaseSystem.dmg

    # Restore the 10.14 Installer’s BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
    hdiutil create -o ./Mojave.cdr -size 8965m -layout SPUD -fs HFS+J
    hdiutil attach ./Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    cp ./BaseSystem.dmg /Volumes/macOS\ Base\ System/
    hdiutil detach /Volumes/macOS\ Base\ System/
    hdiutil convert ./Mojave.cdr.dmg -format UDTO -o ./Mojave.iso
    mv ./Mojave.iso.cdr ~/Desktop/Mojave.iso

  6. Daniel

    Hi,

    nice solution. Unfortunately, a small mistake has crept in there. In Mojave you have to replace “/Volumes/OS\ X\ Base\ System/” by “Volumes/macOS\ Base\ System/”, then it works (completely without any error message).

  7. anon4ce

    If you run into hdiutil deattach errors, try running this first: hdiutil info | grep /dev/disk | grep partition | cut -f 1 | xargs hdiutil detach.

  8. Alberto

    Thanks for the script!
    I think you need only to update the path

    /Volumes/OS\ X\ Base\ System/

    to

    /Volumes/macOS\ Base\ System/

    (I had to adjust it to make it work)
    Alberto.

  9. Dan

    Hey, first of all, thanks for the script. Unfortunately, Apple changed a few things between when you wrote it and now, so it no longer works as written when using a fresh download of Mojave. The problem, specifically, is that Apple changed some of the volume names from “OS X”, now they are called “macOS”. So, the solution is to replace some of the instances of “OS\ X” in your script with “macOS\”.

    This modified version of your script works (at least for right now, September 27, 2019):

    #!/usr/bin/env bash
    hdiutil attach /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/mojave/
    hdiutil create -o ./MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J
    hdiutil attach ./MojaveBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    rm -rf /Volumes/OS\ X\ Base\ System/System/Installation/Packages
    mkdir -p /Volumes/OS\ X\ Base\ System/System/Installation/Packages
    cp -R /Volumes/mojave/Packages/* /Volumes/macOS\ Base\ System/System/Installation/Packages/
    hdiutil detach /Volumes/macOS\ Base\ System/
    hdiutil detach /Volumes/mojave/
    mv ./MojaveBase.cdr.dmg ./BaseSystem.dmg
    # Restore the 10.13 Installer’s BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
    hdiutil create -o ./Mojave.cdr -size 8965m -layout SPUD -fs HFS+J
    hdiutil attach ./Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    cp ./BaseSystem.dmg /Volumes/macOS\ Base\ System
    hdiutil detach /Volumes/macOS\ Base\ System/
    hdiutil convert ./Mojave.cdr.dmg -format UDTO -o ./Mojave.iso
    mv ./Mojave.iso.cdr ~/Desktop/Mojave.iso
    rm ./Mojave.cdr.dmg

  10. Dai

    Update: Creating a macOS 10.15 Catalina installation ISO

    #!/usr/bin/env bash

    hdiutil attach /Applications/Install\ macOS\ Catalina\.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/catalina

    hdiutil create -o ./CatalinaBase.cdr -size 9416m -layout SPUD -fs HFS+J

    hdiutil attach ./CatalinaBase.cdr.dmg -noverify -mountpoint /Volumes/install_build

    asr restore -source /Applications/Install\ macOS\ Catalina\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

    rm -rf /Volumes/macOS\ Base\ System/System/Installation/Packages
    mkdir -p /Volumes/macOS\ Base\ System/System/Installation/Packages
    cp -R /Volumes/catalina/Packages/* /Volumes/macOS\ Base\ System/System/Installation/Packages/
    hdiutil detach /Volumes/macOS\ Base\ System/
    hdiutil detach /Volumes/catalina/
    mv ./CatalinaBase.cdr.dmg ./BaseSystem.dmg

    # Restore the 10.15 Installer’s BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
    hdiutil create -o ./Catalina.cdr -size 12g -layout SPUD -fs HFS+J
    hdiutil attach ./Catalina.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ Catalina\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    cp ./BaseSystem.dmg /Volumes/macOS\ Base\ System
    hdiutil detach /Volumes/macOS\ Base\ System/
    hdiutil convert ./Catalina.cdr.dmg -format UDTO -o ./Catalina.iso
    mv ./Catalina.iso.cdr ~/Desktop/Catalina.iso
    rm ./Catalina.cdr.dmg

  11. Ken

    This is broken under Catalina because the mount point is no longer “OS X Base System” but is now “macOS Base System”. Making that change in the script allows it to function normally.

  12. Bill Plein Post author

    Sorry about the delays in posting your comments! All valuable. If I can find the time I’ll update the original post and give credit where due!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.