How to Download and Create a macOS Sonoma Installation ISO Image

This blog post documents the process of downloading the macOS Sonoma installation files on a Mac and converting them into an ISO image. Please note that this method is not applicable for Windows operating systems.

The method described below requires a real Mac to perform the necessary operations.

This blog post is translated from my Chinese blog post, the content in the images used in the post may still be in Chinese, sorry for the inconvenience.

Download macOS Installation Files

  1. Open the gibMacOS GitHub repository. This is a Python script that helps us download macOS-related files directly from Apple servers.
  2. Click the Code button in the top right corner, then click Download ZIP to download the file.
    Download gibMacOS.jpg
  3. Extract the downloaded file.
  4. Double click to open the gibMacOS.command. During the process, several permission request pop-ups will appear. Allow all of them.
  5. If Python is not installed on your system, you will be prompted to install it. Press Y and hit Enter to install.
  6. Enter the number corresponding to the macOS version you want to download and press Enter to download the installation files.
  7. Once the download is complete, open the macOS Downloads folder in the gibMacOS directory.
  8. Double click the InstallAssistant.pkg file in the corresponding version folder and install it.

Create the ISO Image

Next, we will use the hdiutil tool to create an ISO image file. hdiutil is a command-line utility on macOS for manipulating disk image files.

Open the Terminal on your macOS and enter the following commands step by step, adjusting the parameters as necessary:

  1. Create a new disk image file:

    1
    hdiutil create -o /tmp/macOS -size 16000m -volname macOS -layout SPUD -fs HFS+J
    • hdiutil create: Creates a new disk image file.
    • -o /tmp/macOS: Specifies the output file path as /tmp/macOS.
    • -size 16000m: Sets the disk image size to 16000 MB (16 GB). Ensure the disk image size is larger than the downloaded installation files.
    • -volname macOS: Sets the volume name to “macOS”.
    • -layout SPUD: Uses the SPUD (Single Partition, Apple Partition Map) layout.
    • -fs HFS+J: Uses the HFS+ (Mac OS Extended) file system with journaling enabled.
    • The output will be a disk image file named /tmp/macOS.dmg.
  2. Mount the disk image file:

    1
    hdiutil attach /tmp/macOS.dmg -noverify -mountpoint /Volumes/macOSISO
    • hdiutil attach: Mounts a disk image file.
    • /tmp/macOS.dmg: Specifies the disk image file path to mount.
    • -noverify: Skips the disk image verification process.
    • -mountpoint /Volumes/macOSISO: Specifies the mount point as /Volumes/macOSISO.
  3. Create a bootable installer using the macOS installation app:

    1
    sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/macOSISO --nointeraction
    • sudo: Runs the command with superuser privileges.
    • /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia: Invokes the createinstallmedia tool from the macOS installation app.
    • --volume /Volumes/macOSISO: Specifies the target volume as the mounted disk image file.
    • --nointeraction: Executes the process without user interaction.
  4. Unmount the mounted installer:

    1
    hdiutil detach -force /Volumes/Install\ macOS\ Sonoma
    • hdiutil detach: Unmounts a mounted disk image file.
    • -force: Forces the unmount, even if files are in use.
    • /Volumes/Install\ macOS\ Sonoma: Specifies the mount point to unmount.
  5. Convert the disk image file format:

    1
    hdiutil convert /tmp/macOS.dmg -format UDTO -o ~/Desktop/macOS.cdr
    • hdiutil convert: Converts the disk image file format.
    • /tmp/macOS.dmg: Specifies the source disk image file to convert.
    • -format UDTO: Converts the disk image file to UDTO (DVD/CD-R Master) format.
    • -o ~/Desktop/macOS.cdr: Specifies the output file path as ~/Desktop/macOS.cdr.
  6. Rename the file extension:

    1
    mv ~/Desktop/macOS.cdr ~/Desktop/macOS.iso
    • mv: Moves or renames a file.
    • ~/Desktop/macOS.cdr: Specifies the source file path.
    • ~/Desktop/macOS.iso: Specifies the target file path, changing the extension from .cdr to .iso.

Disk Image Files

DMG files (Disk Image Files) are a common disk image file format used on macOS. They are typically used for distributing software, storing backups, or creating bootable installation media. DMG files can contain one or more files and folders and can be mounted as virtual disks, allowing access to the files and folders as if they were on a physical disk.