From 8a93aaf85281bafd0557518341f913a96b2d2bf1 Mon Sep 17 00:00:00 2001 From: Tieu Long Date: Sun, 21 Dec 2025 01:04:38 +0700 Subject: [PATCH] ref: add proper Apple silicon support, apped '.iso' to DMG image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While the script is compatible with Apple silicon Macs, it’s still recommended to run it on an x86_64 Intel Mac for optimal results. For easier use and distribution, the final DMG image will have '.iso' appended to its file name. Rufus no longer require switching to "All files" to saw the DMG image in Explorer. Also fix "qemu-img: Could not locate UDIF trailer in dmg file" error. --- .github/workflows/build.yml | 49 +-- README.md | 12 +- mkmaciso | 576 +++++++++++++++++++++++++----------- 3 files changed, 441 insertions(+), 196 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10ee33f..b052f56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ on: - 'Mountain Lion' - 'Lion' image_format: - description: 'Select image format: iso for virtual machines, dmg for burning to USB drive' + description: 'Select image format: iso for virtual machines, dmg for flash to USB drive' required: true type: choice options: @@ -48,18 +48,19 @@ jobs: df -h echo "Memory:" top -l 1 | grep PhysMem + echo "CPU model:" + sysctl -a | grep dep.cpu.brand_string - - name: Create Image + - name: Create macOS image id: create_image + continue-on-error: true run: | if [ "${{ github.event.inputs.image_format }}" == "iso" ]; then - echo "Creating macOS ${{ github.event.inputs.macos_version }} ISO image" - bash mkmaciso "${{ github.event.inputs.macos_version }}" + sudo bash mkmaciso "${{ github.event.inputs.macos_version }}" echo "image_name=$(basename *.iso)" >> $GITHUB_OUTPUT else - echo "Creating macOS ${{ github.event.inputs.macos_version }} DMG image" - bash mkmaciso "${{ github.event.inputs.macos_version }}" dmg - echo "image_name=$(basename *.dmg)" >> $GITHUB_OUTPUT + sudo bash mkmaciso "${{ github.event.inputs.macos_version }}" dmg + echo "image_name=$(basename *.dmg.iso)" >> $GITHUB_OUTPUT fi - name: Upload ISO artifact @@ -76,21 +77,31 @@ jobs: uses: actions/upload-artifact@v5 with: name: ${{ steps.create_image.outputs.image_name }} - path: ./*.dmg + path: ./*.dmg.iso compression-level: 0 retention-days: 7 - name: Summary + if: always() run: | - if [ "${{ github.event.inputs.image_format }}" == "iso" ]; then - echo "## Successfully built $(basename *.iso)" >> $GITHUB_STEP_SUMMARY - echo "Note: This ISO is intended for create macOS virtual machine on Proxmox VE, QEMU, VMware, and VirtualBox." >> $GITHUB_STEP_SUMMARY - else - echo "## Successfully built $(basename *.dmg)" >> $GITHUB_STEP_SUMMARY - echo 'Note: This DMG is intended for flash to USB drive using [Rufus](https://rufus.ie/en/#download) (Windows) or dd (Linux)' >> $GITHUB_STEP_SUMMARY + if [ "${{ steps.create_image.outcome }}" == "failure" ]; then + echo "## Download macOS failed" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY + echo "> This runner may have network issues. Please **re-run the workflow** to try a different runner." >> $GITHUB_STEP_SUMMARY + elif [ "${{ job.status }}" == "success" ]; then + if [ "${{ github.event.inputs.image_format }}" == "iso" ]; then + echo "## Successfully built $(basename *.iso)" >> $GITHUB_STEP_SUMMARY + echo "Note: This ISO image is intended for create macOS virtual machine on Proxmox VE, QEMU, VMware, and VirtualBox." >> $GITHUB_STEP_SUMMARY + else + echo "## Successfully built $(basename *.dmg.iso)" >> $GITHUB_STEP_SUMMARY + echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY + echo '> This DMG image is intended for flash to USB drive using [Rufus](https://rufus.ie/en/#download) (Windows) or dd (Linux)' >> $GITHUB_STEP_SUMMARY + echo '> Can also be used with virtual machines (require convert to `.vhd` for Hyper-V or `.vmdk` for VMware)' >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY + echo "Found this useful? [Give it a ⭐ star](https://github.com/LongQT-sea/macos-iso-builder) so others can find it too!" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "> [!TIP]" >> $GITHUB_STEP_SUMMARY + echo "> Enable [Cloudflare WARP](https://one.one.one.one/) for faster downloads." >> $GITHUB_STEP_SUMMARY fi - echo "" >> $GITHUB_STEP_SUMMARY - echo "Found this useful? Give it a ⭐ star so others can find it too! https://github.com/LongQT-sea/macos-iso-builder" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "> [!TIP]" >> $GITHUB_STEP_SUMMARY - echo "> Enable [Cloudflare WARP](https://one.one.one.one/) for faster downloads." >> $GITHUB_STEP_SUMMARY diff --git a/README.md b/README.md index f998052..23cf7b2 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ > [!IMPORTANT] > * Use the **"Build macOS Recovery ISO image"** workflow unless you really need an offline installer. > * GitHub-hosted runners are a free public resource — please use them responsibly. -> * Already have macOS? Build macOS installer ISO/DMG image with this command (replace `tahoe` with the desired version): +> * If you already have macOS VM, you can build macOS ISO/DMG image using the following command (replace `tahoe` with your desired version): ``` -curl -L https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkmaciso | bash -s tahoe +curl -sL https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkmaciso | bash -s tahoe ``` --- @@ -27,7 +27,7 @@ curl -L https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkma 1. **Fork** this repository. 2. Go to the **Actions** tab in your forked repository. 3. Click the green button **"I understand my workflows, go ahead and enable them"**. -4. Select the **"Build macOS Installer ISO/DMG image"** or **"Build macOS Recovery ISO image"** workflow from the left sidebar.. +4. Select the **"Build macOS Installer ISO/DMG image"** or **"Build macOS Recovery ISO image"** workflow from the left sidebar. 5. Click the **"Run workflow"** button. 6. Configure the workflow inputs: @@ -37,8 +37,6 @@ curl -L https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkma 8. Wait for the workflow to complete (this may take 10-60 minutes). 9. Open the completed workflow run and scroll to the **Artifacts** section. 10. Download the artifact (e.g., `macOS_Sequoia_15.7.3.iso`). -> [!TIP] -> Enable [Cloudflare WARP](https://one.one.one.one/) for faster downloads. 11. Extract the ZIP file to get your `.iso` or `.dmg` file. --- @@ -46,9 +44,9 @@ curl -L https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkma > [!TIP] > To create a bootable macOS installer USB drive on Windows: > 1. Open [Rufus](https://rufus.ie/en/#download) -> 2. Click **SELECT**, change the filter to **"All files"**, then select your macOS `.dmg` +> 2. Click **SELECT**, then select your macOS `.dmg.iso` image > 3. Click **START** -> 4. Optional: After flashing the `dmg` image to the USB drive, there will be free/unallocated space remaining on the USB drive. Use Disk Management to create a new FAT32 partition and place your EFI folder there if needed. +> 4. Optional: After flashing the DMG image to the USB drive, there will be free/unallocated space remaining on the USB drive. Use Disk Management to create a new FAT32 partition and place your EFI folder there if needed. > [!NOTE] > By default, artifacts are kept for 7 days. You can change this in the workflow YAML file. diff --git a/mkmaciso b/mkmaciso index 87968e0..0c3cd96 100755 --- a/mkmaciso +++ b/mkmaciso @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Copyright (c) 2024–2025, LongQT-sea -# mkmaciso - the ultimate macOS utility for creating macOS installer ISO and DMG images +# mkmaciso – the ultimate tool for creating macOS installer ISO and DMG images # Run with -h or --help to show usage. @@ -22,8 +22,15 @@ # - Can also be used with virtual machines, but must be attached as a virtual hard disk. # - Most VMM require convert the .dmg image to a compatible virtual disk format using qemu-img, # e.g. convert to .vhd for Hyper-V or .vmdk for VMware. QEMU can use raw disk image without conversion. +# +# For easier use and distribution, the final DMG image will have '.iso' appended to its file name. +# Rufus no longer require switching to "All files" to saw the DMG image in Explorer. +# Also fix "qemu-img: Could not locate UDIF trailer in dmg file" error. +# +# While the script is compatible with Apple silicon Macs, it’s still recommended to run it on an x86_64 Intel Mac for optimal results. set -e # Exit on error +#set -x # Debug # Official Apple download URLs for macOS 10.7-10.12 (except 10.9) # https://support.apple.com/en-hk/102662#browser @@ -33,6 +40,12 @@ YOSEMITE_URL="http://updates-http.cdn-apple.com/2019/cert/061-41343-20191023-024 EL_CAPITAN_URL="http://updates-http.cdn-apple.com/2019/cert/061-41424-20191024-218af9ec-cf50-4516-9011-228c78eda3d2/InstallMacOSX.dmg" SIERRA_URL="http://updates-http.cdn-apple.com/2019/cert/061-39476-20191023-48f365f4-0015-4c41-9f44-39d3d2aca067/InstallOS.dmg" +# Official Apple download URLs for macOS 10.13-10.15 +# https://swscan.apple.com/content/catalogs/others/index-15-14-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog +CATALINA_BASE_URL=https://swcdn.apple.com/content/downloads/26/37/001-68446/r1dbqtmf3mtpikjnd04cq31p4jk91dceh8/ +MOJAVE_BASE_URL=https://swcdn.apple.com/content/downloads/17/32/061-26589-A_8GJTCGY9PC/25fhcu905eta7wau7aoafu8rvdm7k1j4el/ +HIGH_SIERRA_BASE_URL=https://swcdn.apple.com/content/downloads/06/50/041-91758-A_M8T44LH2AW/b5r4og05fhbgatve4agwy4kgkzv07mdid9/ + # Default parameters VERSION="${1:-}" IMAGE_FORMAT="${2:-}" @@ -41,6 +54,9 @@ RETRIES_COUNT=10 FINAL_OUTPUT_PATH="" DISK_ID="" +# Get CPU architecture +CPU_ARCH=$(uname -m) + # Color codes for output RED='\033[0;31m' GREEN='\033[0;32m' @@ -54,15 +70,15 @@ NC='\033[0m' # No Color # Helper functions log_info() { - echo -e "${GREEN}[INFO]${NC} $1" + echo -e "${GREEN}$(date +'%H:%M:%S') [INFO]${NC} $1" } log_warn() { - echo -e "${YELLOW}[WARN]${NC} $1" + echo -e "${YELLOW}$(date +'%H:%M:%S') [WARN]${NC} $1" } log_error() { - echo -e "${RED}[ERROR]${NC} $1" + echo -e "${RED}$(date +'%H:%M:%S') [ERROR]${NC} $1" } check_sudo_access() { @@ -77,12 +93,17 @@ check_sudo_access() { check_disk_space() { local required_gb=40 + local threshold_gb=15 local available=$(df -g . | awk 'NR==2 {print $4}') - if [ "$available" -lt "$required_gb" ]; then + if [ "$available" -lt "$threshold_gb" ]; then + log_error "CRITICAL: Only ${available} GB available, (${required_gb} GB or more recommended" + log_error "Cannot continue due to low disk space" + exit 1 + elif [ "$available" -lt "$required_gb" ]; then log_error "WARNING: Low disk space - ${available} GB available, ${required_gb} GB or more recommended" - log_warn "" - log_warn "Continue? (Y/n - auto-yes in 10 seconds): " + echo "" + echo -ne "${YELLOW}[WARN]${NC} Continue? (Y/n - auto-yes in 10 seconds): " read -t 10 answer || answer="y" case "$answer" in [Nn]|[Nn][Oo]) @@ -91,6 +112,7 @@ check_disk_space() { ;; *) log_info "Continuing..." + echo "" ;; esac fi @@ -103,7 +125,7 @@ detach_disk() { for attempt in $(seq 1 "$RETRIES_COUNT"); do log_info "Detach attempt $attempt of $RETRIES_COUNT..." - if sync && sleep 5 && hdiutil detach "$disk" 2>/dev/null || hdiutil detach "$disk" -force 2>/dev/null; then + if sync && sleep 5 && hdiutil detach -quiet "$disk" || hdiutil detach -quiet "$disk" -force; then log_info "Disk detached successfully" return 0 fi @@ -121,7 +143,11 @@ cleanup() { for mnt in "$WORK_DIR"/*_mnt; do [ -d "$mnt" ] && detach_disk "$mnt" 2>/dev/null || true done - + + if [ -n "${DISK_ID:-}" ]; then + detach_disk "$DISK_ID" + fi + log_info "Cleaning up temporary files..." sudo rm -rf "$WORK_DIR" fi @@ -533,7 +559,7 @@ download_legacy_macos() { ;; "10.9") download_mavericks - return + return $? ;; "10.10") download_url="$YOSEMITE_URL" @@ -610,21 +636,21 @@ k=$key") install_legacy_app() { local version_num="$1" local dmg_file="$2" - local cpu_arch=$(uname -m) log_info "Installing macOS $(get_codename $version_num) installer to /Applications..." - # Check if version is in the legacy list if [[ "$version_num" =~ ^(10\.7|10\.8|10\.10|10\.11|10\.12)$ ]]; then - # Mount the DMG - hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/installer_mnt" "$dmg_file" + # Mount the downloaded DMG image + hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/downloaded_dmg_mnt" "$dmg_file" - # Manual installation process for Apple silicon - if [ "$cpu_arch" == "arm64" ]; then + # Manual installation process for Apple silicon. + # The 'Install OSX/macOS.app' produced by manual install is not suitable + # for creating a bootable USB using 'createinstallmedia'. + if [ "$CPU_ARCH" == "arm64" ]; then log_info "Apple silicon detected, using manual installation..." # Extract the package - pkgutil --expand "$WORK_DIR/installer_mnt"/*.pkg "$WORK_DIR/pkg_extracted" + pkgutil --expand "$WORK_DIR/downloaded_dmg_mnt"/*.pkg "$WORK_DIR/pkg_extracted" # Find the inner package directory (InstallMacOSX.pkg) local inner_pkg=$(ls -d "$WORK_DIR/pkg_extracted"/*.pkg 2>/dev/null | head -1) @@ -636,17 +662,19 @@ install_legacy_app() { # Copy InstallESD.dmg local app_path="/Applications/$(get_installer_app_name $version_num).app" - sudo cp "$inner_pkg/InstallESD.dmg" "$app_path/Contents/SharedSupport/InstallESD.dmg" + sudo ditto "$inner_pkg/InstallESD.dmg" "$app_path/Contents/SharedSupport/InstallESD.dmg" sudo chown root:wheel "$app_path/Contents/SharedSupport/InstallESD.dmg" log_info "Installed $(get_installer_app_name $version_num) to /Applications" + log_warn "Note: This $(get_installer_app_name $version_num) is not suitable for creating a bootable USB using 'createinstallmedia'" + else # Standard installation for Intel Macs - sudo installer -pkg "$WORK_DIR/installer_mnt"/*.pkg -target / && \ + sudo installer -pkg "$WORK_DIR/downloaded_dmg_mnt"/*.pkg -target / && \ log_info "Installed $(get_installer_app_name $version_num) to /Applications" fi - sync && detach_disk "$WORK_DIR/installer_mnt" + sync && detach_disk "$WORK_DIR/downloaded_dmg_mnt" elif [ "$version_num" == "10.9" ]; then # Check if InstallESD.dmg exists @@ -671,38 +699,154 @@ install_legacy_app() { fi } +# Reference: https://www.insanelymac.com/forum/topic/338810-create-legit-copy-of-macos-from-apple-catalog/ +direct_download_10_13_10_15() { + local version_num="$1" + local base_url="" + local version_name="" + + # Determine base URL and version name + case "$version_num" in + "10.13") + base_url="$HIGH_SIERRA_BASE_URL" + version_name="High Sierra" + ;; + "10.14") + base_url="$MOJAVE_BASE_URL" + version_name="Mojave" + ;; + "10.15") + base_url="$CATALINA_BASE_URL" + version_name="Catalina" + ;; + *) + return 1 + ;; + esac + + log_info "Downloading macOS $(get_codename $version_num) installer using direct Apple URLs..." + echo "" + + # Required files for 10.13-10.15 + local files=( + "BaseSystem.dmg" + "BaseSystem.chunklist" + "InstallInfo.plist" + "InstallESDDmg.pkg" + "AppleDiagnostics.dmg" + "AppleDiagnostics.chunklist" + ) + + # Download all required files + for filename in "${files[@]}"; do + log_info "Downloading ${filename}..." + curl --retry 5 --retry-all-errors --max-time 1800 --connect-timeout 10 --progress-bar \ + -L "${base_url}${filename}" -o "$WORK_DIR/${filename}" + if [ $? -ne 0 ]; then + log_error "Failed to download ${filename}" + return 1 + fi + done + + echo "" + log_info "All files downloaded. Building macOS $(get_codename $version_num) installer app..." + + # Mount BaseSystem.dmg to extract the app + hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/BaseSystem_mnt" "$WORK_DIR/BaseSystem.dmg" + + # Copy installer app to /Applications + local installer_app="$WORK_DIR/BaseSystem_mnt/$(get_installer_app_name $version_num).app" + sudo cp -Rp "$installer_app" "/Applications/" + + # Create SharedSupport directory + local shared_support="/Applications/$(get_installer_app_name $version_num).app/Contents/SharedSupport" + sudo mkdir -p "$shared_support" + + # Rename InstallESDDmg.pkg to InstallESD.dmg + mv "$WORK_DIR/InstallESDDmg.pkg" "$WORK_DIR/InstallESD.dmg" + + # Fix InstallInfo.plist + sed -e "s/InstallESDDmg\.pkg/InstallESD.dmg/" \ + -e "s/pkg\.InstallESDDmg/dmg.InstallESD/" \ + -e "/InstallESD\.dmg/{n;N;N;N;d;}" \ + "$WORK_DIR/InstallInfo.plist" > "$WORK_DIR/InstallInfo_fixed.plist" + + # Copy files to SharedSupport + sudo cp -Rp "$WORK_DIR/BaseSystem.dmg" "$shared_support/" + sudo cp -Rp "$WORK_DIR/BaseSystem.chunklist" "$shared_support/" + sudo cp -Rp "$WORK_DIR/InstallInfo_fixed.plist" "$shared_support/InstallInfo.plist" + sudo cp -Rp "$WORK_DIR/InstallESD.dmg" "$shared_support/" + sudo cp -Rp "$WORK_DIR/AppleDiagnostics.dmg" "$shared_support/" + sudo cp -Rp "$WORK_DIR/AppleDiagnostics.chunklist" "$shared_support/" + + # Set proper ownership + sudo chown -R root:wheel "$shared_support" + + # Resign createinstallmedia and remove quarantine tag for Apple Silicon + if [ "$CPU_ARCH" == "arm64" ] && [[ "$version_num" =~ ^10\.1[3-5]$ ]]; then + sudo codesign -s - -f "/Applications/$(get_installer_app_name $version_num).app/Contents/Resources/createinstallmedia" + sudo xattr -r -d com.apple.quarantine "/Applications/$(get_installer_app_name $version_num).app" + fi + + # Detach BaseSystem.dmg + sync && sleep 10 && detach_disk "$WORK_DIR/BaseSystem_mnt" + + log_info "Successfully installed $(get_installer_app_name $version_num) to /Applications" + return 0 +} + download_modern_macos() { local version_num="$1" version_name=$(get_codename $version_num) version_name="${version_name/_/ }" - # Get CPU architecture - local cpu_arch=$(uname -m) - # Get current macOS kernel version local kernel_version=$(uname -r | cut -d'.' -f1) - # Extract major version from version_num for comparison - local requested_major_version - if [[ "$version_num" =~ ^10\.([0-9]+)$ ]]; then - requested_major_version="${version_num}" - else - requested_major_version="$version_num" + # Use direct download when softwareupdate is not available + if [[ "$version_num" =~ ^10\.1[345]$ ]]; then + # For Apple silicon: always use direct download for 10.13-10.15 + if [ "$CPU_ARCH" == "arm64" ]; then + log_info "Apple silicon detected" + echo "" + + # Show warning on Apple silicon + log_warn "╔═════════════════════════════════════════════════════════════════╗" + log_warn "║ Apple silicon Limitation ║" + log_warn "╠═════════════════════════════════════════════════════════════════╣" + log_warn "║ On Apple silicon, softwareupdate cannot download macOS versions ║" + log_warn "║ older than the one that originally shipped with your device. ║" + log_warn "╚═════════════════════════════════════════════════════════════════╝" + echo "" + direct_download_10_13_10_15 "$version_num" + return $? + fi + + # For Intel: use direct download if running kernel < 20 (pre-Big Sur) + if [ "$CPU_ARCH" == "x86_64" ]; then + log_info "Intel CPU detected" + + if [ "$kernel_version" -lt 20 ]; then + log_info "This Mac is running a version older than Big Sur, will attempt direct download" + direct_download_10_13_10_15 "$version_num" + return $? + fi + fi fi - # Check CPU architecture compatibility - if [ "$cpu_arch" == "x86_64" ]; then + # For macOS 11+ or when running Big Sur+, use softwareupdate + # Check CPU architecture compatibility for softwareupdate + if [ "$CPU_ARCH" == "x86_64" ]; then log_info "Intel CPU detected" # Intel Macs require macOS 11 or newer for softwareupdate - # Check if current system is at least macOS 11 (kernel 20) if [ "$kernel_version" -lt 20 ]; then log_error "Intel Macs must be running macOS 11 (Big Sur) or newer to download macOS using softwareupdate" log_error "Please upgrade your macOS to version 11 or newer" return 1 fi - elif [ "$cpu_arch" == "arm64" ]; then + elif [ "$CPU_ARCH" == "arm64" ]; then log_info "Apple silicon detected" # Show warning on Apple silicon @@ -712,14 +856,6 @@ download_modern_macos() { log_warn "║ On Apple silicon, softwareupdate cannot download macOS versions ║" log_warn "║ older than the one that originally shipped with your device. ║" log_warn "╚═════════════════════════════════════════════════════════════════╝" - - # Check if requested version is older than macOS 11 - if [[ "$version_num" =~ ^10\. ]]; then - log_error "Apple silicon Macs cannot download macOS 10.13 - 10.15 using softwareupdate." - log_error "Please use gibMacOS to download macOS $version_name, or request macOS 11 (Big Sur) or a newer version." - log_error "Requested version: $version_name" - return 1 - fi fi log_info "Fetching available macOS installers..." @@ -761,52 +897,42 @@ download_modern_macos() { done } -create_iso_10_7_10_8() { +create_iso_dmg_10_7_10_8() { local installer_path="$1" local output_file="$2" local volume_name="$3" local version_num="$4" + local image_format=$(echo "$IMAGE_FORMAT" | tr '[:lower:]' '[:upper:]') - log_info "Creating macOS $(get_codename $version_num) ISO image..." - echo "" - - # Mount InstallESD.dmg for version extraction - hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/InstallESD_mnt" "$installer_path/Contents/SharedSupport/InstallESD.dmg" - - # Extract the exact version number and append it to the file name - exact_version_number=$(defaults read "$WORK_DIR/InstallESD_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) - FINAL_OUTPUT_PATH="${output_file%.iso}_$exact_version_number.iso" - - # Unmount - sync && detach_disk "$WORK_DIR/InstallESD_mnt" - - # Create ISO directly from InstallESD.dmg - sudo hdiutil makehybrid -ov -hfs -udf -default-volume-name "$volume_name" \ - "$installer_path/Contents/SharedSupport/InstallESD.dmg" -o "$FINAL_OUTPUT_PATH" -} - -create_dmg_10_7_10_8() { - local installer_path="$1" - local output_file="$2" - local volume_name="$3" - local version_num="$4" - - log_info "Creating macOS $(get_codename $version_num) DMG image..." + log_info "Creating macOS $(get_codename $version_num) $image_format image..." echo "" # Mount InstallESD.dmg hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/InstallESD_mnt" "$installer_path/Contents/SharedSupport/InstallESD.dmg" # Extract the exact version number and append it to the file name - exact_version_number=$(defaults read "$WORK_DIR/InstallESD_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) - FINAL_OUTPUT_PATH="${output_file%.dmg}_$exact_version_number.dmg" - - # Create DMG with GUID Partition Table from mounted InstallESD.dmg - sudo hdiutil create -layout GPTSPUD -format UDRW -ov \ - -volname "$volume_name" -srcdir "$WORK_DIR/InstallESD_mnt" "$FINAL_OUTPUT_PATH" - - # Unmount - sync && detach_disk "$WORK_DIR/InstallESD_mnt" + local exact_version_number=$(defaults read "$WORK_DIR/InstallESD_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) + FINAL_OUTPUT_PATH="${output_file%.${IMAGE_FORMAT}}_$exact_version_number.${IMAGE_FORMAT}" + + # Create final image + if [ "$IMAGE_FORMAT" == "dmg" ]; then + # Create DMG with GUID Partition Table from mounted InstallESD.dmg + sudo hdiutil create -quiet -layout GPTSPUD -format UDRW -ov -volname "$volume_name" -srcdir "$WORK_DIR/InstallESD_mnt" "$FINAL_OUTPUT_PATH" + + # Append .iso extension + mv -f "$FINAL_OUTPUT_PATH" "${FINAL_OUTPUT_PATH}.iso" + + # Unmount + sync && detach_disk "$WORK_DIR/InstallESD_mnt" + + FINAL_OUTPUT_PATH="${FINAL_OUTPUT_PATH}.iso" + else + # Unmount + sync && detach_disk "$WORK_DIR/InstallESD_mnt" + + log_info "Converting to ISO format..." + sudo hdiutil makehybrid -quiet -ov -hfs -udf -default-volume-name "$volume_name" "$installer_path/Contents/SharedSupport/InstallESD.dmg" -o "$FINAL_OUTPUT_PATH" + fi } create_iso_10_9_10_11() { @@ -816,7 +942,6 @@ create_iso_10_9_10_11() { local version_num="$4" log_info "Creating macOS $(get_codename $version_num) ISO image..." - echo "" # Mount InstallESD.dmg local installesd_path="$installer_path/Contents/SharedSupport/InstallESD.dmg" @@ -824,13 +949,13 @@ create_iso_10_9_10_11() { hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/InstallESD_mnt" "$installesd_path" # Convert BaseSystem.dmg - hdiutil convert "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" -format UDRW -o "$WORK_DIR/BaseSystem" >/dev/null 2>&1 + hdiutil convert -quiet "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" -format UDRW -o "$WORK_DIR/BaseSystem_converted.dmg" >/dev/null 2>&1 - # Resize - sudo hdiutil resize -size 8g "$WORK_DIR/BaseSystem.dmg" + # Increase size + sudo hdiutil resize -size 7.1g "$WORK_DIR/BaseSystem_converted.dmg" # Mount the converted DMG - DISK_ID=$(hdiutil attach -nobrowse -mountpoint "$WORK_DIR/BaseSystem_mnt" "$WORK_DIR/BaseSystem.dmg" | grep -o '/dev/disk[0-9]*' | head -1) + DISK_ID=$(hdiutil attach -nobrowse -mountpoint "$WORK_DIR/BaseSystem_mnt" "$WORK_DIR/BaseSystem_converted.dmg" | grep -o '/dev/disk[0-9]*' | head -1) # Remove Packages symlink and copy actual Packages rm "$WORK_DIR/BaseSystem_mnt/System/Installation/Packages" @@ -847,7 +972,7 @@ create_iso_10_9_10_11() { fi # Extract the exact version number and append it to the file name - exact_version_number=$(defaults read "$WORK_DIR/BaseSystem_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) + local exact_version_number=$(defaults read "$WORK_DIR/BaseSystem_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) FINAL_OUTPUT_PATH="${output_file%.iso}_$exact_version_number.iso" # Unmount @@ -855,11 +980,12 @@ create_iso_10_9_10_11() { detach_disk "$DISK_ID" && DISK_ID="" # Create ISO - sudo hdiutil makehybrid -ov -hfs -udf -default-volume-name "$volume_name" \ - "$WORK_DIR/BaseSystem.dmg" -o "$FINAL_OUTPUT_PATH" + log_info "Converting to ISO format..." + sudo hdiutil makehybrid -quiet -ov -hfs -udf -default-volume-name "$volume_name" \ + "$WORK_DIR/BaseSystem_converted.dmg" -o "$FINAL_OUTPUT_PATH" } -create_dmg_10_9() { +create_dmg_10_9_to_10_12_alt_method() { local installer_path="$1" local output_file="$2" local volume_name="$3" @@ -872,22 +998,42 @@ create_dmg_10_9() { local installesd_path="$installer_path/Contents/SharedSupport/InstallESD.dmg" hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/InstallESD_mnt" "$installesd_path" - - # Attach BaseSystem.dmg - BaseSystem_DISK_ID=$(hdiutil attach "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" -nomount | grep -o '/dev/disk[0-9]*' | head -1) - - # Create a DMG with GUID Partition Table and attach it - hdiutil create -ov -fs hfs+ -size 1.4g "$WORK_DIR/installer_gpt.dmg" >/dev/null 2>&1 - DISK_ID=$(hdiutil attach "$WORK_DIR/installer_gpt.dmg" -nomount | grep -o '/dev/disk[0-9]*' | head -1) - # Write the bootable recovery partition to the first partition on the DMG image - sudo dd if="${BaseSystem_DISK_ID}s2" of="${DISK_ID}s1" bs=1m && detach_disk "$BaseSystem_DISK_ID" - - # Unmount - detach_disk "$DISK_ID" && DISK_ID="" - - # Increase size - sudo hdiutil resize -size 8g "$WORK_DIR/installer_gpt.dmg" + if [[ "$version_num" =~ ^(10\.9|10\.10)$ ]]; then + # Attach BaseSystem.dmg + BaseSystem_DISK_ID=$(hdiutil attach "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" -nomount | grep -o '/dev/disk[0-9]*' | head -1) + + # Create a DMG with GUID Partition Table and attach it + hdiutil create -quiet -ov -fs hfs+ -size 1400m "$WORK_DIR/installer_gpt.dmg" + DISK_ID=$(hdiutil attach "$WORK_DIR/installer_gpt.dmg" -nomount | grep -o '/dev/disk[0-9]*' | head -1) + + # Write the bootable recovery partition to the first partition on the DMG image + sudo dd if="${BaseSystem_DISK_ID}s2" of="${DISK_ID}s1" bs=1m && detach_disk "$BaseSystem_DISK_ID" + + # Unmount + detach_disk "$DISK_ID" && DISK_ID="" + + # Increase size + sudo hdiutil resize -size 7g "$WORK_DIR/installer_gpt.dmg" + + elif [[ "$version_num" =~ ^(10\.11|10\.12)$ ]]; then + local dmg_size + case "$version_num" in + "10.11") + dmg_size="7.1" + ;; + *) + dmg_size="5.9" + ;; + esac + + # El Capitan and Sierra BaseSystem.dmg already use a GUID Partition Table + # Convert BaseSystem.dmg + hdiutil convert -quiet "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" -format UDRW -o "$WORK_DIR/installer_gpt.dmg" + + # Increase size + sudo hdiutil resize -size ${dmg_size}g "$WORK_DIR/installer_gpt.dmg" + fi # Mount DMG image and change volume name DISK_ID=$(hdiutil attach -nobrowse -mountpoint "$WORK_DIR/installer_mnt" "$WORK_DIR/installer_gpt.dmg" | grep -o '/dev/disk[0-9]*' | head -1) @@ -895,15 +1041,15 @@ create_dmg_10_9() { # Remove Packages symlink and copy actual Packages rm "$WORK_DIR/installer_mnt/System/Installation/Packages" - cp -R "$WORK_DIR/InstallESD_mnt/Packages" "$WORK_DIR/installer_mnt/System/Installation/" + ditto "$WORK_DIR/InstallESD_mnt/Packages" "$WORK_DIR/installer_mnt/System/Installation/Packages" # Copy required files - cp "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" "$WORK_DIR/installer_mnt/" - cp "$WORK_DIR/InstallESD_mnt/BaseSystem.chunklist" "$WORK_DIR/installer_mnt/" + cp -R "$WORK_DIR/InstallESD_mnt/BaseSystem.dmg" "$WORK_DIR/installer_mnt/" + cp -R "$WORK_DIR/InstallESD_mnt/BaseSystem.chunklist" "$WORK_DIR/installer_mnt/" # Extract the exact version number and append it to the file name - exact_version_number=$(defaults read "$WORK_DIR/installer_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) - FINAL_OUTPUT_PATH="${output_file%.dmg}_$exact_version_number.dmg" + local exact_version_number=$(defaults read "$WORK_DIR/installer_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) + FINAL_OUTPUT_PATH="${output_file%.dmg}_$exact_version_number.dmg.iso" sync && sleep 5 @@ -916,24 +1062,107 @@ create_dmg_10_9() { sudo hdiutil resize -size min "$WORK_DIR/installer_gpt.dmg" # Move to output + log_info "Move to $FINAL_OUTPUT_PATH" mv -f "$WORK_DIR/installer_gpt.dmg" "$FINAL_OUTPUT_PATH" } +create_iso_dmg_10_15_alt_method() { + local installer_path="$1" + local output_file="$2" + local volume_name="$3" + local version_num="$4" + local image_format=$(echo "$IMAGE_FORMAT" | tr '[:lower:]' '[:upper:]') + + log_info "Apple Silicon detected. Using alternative method for Catalina instead of 'createinstallmedia'" + echo "" + log_info "Creating macOS $(get_codename $version_num) $image_format image..." + echo "" + + # Mount InstallESD.dmg + local installesd_path="$installer_path/Contents/SharedSupport/InstallESD.dmg" + + hdiutil attach -nobrowse -quiet -mountpoint "$WORK_DIR/InstallESD_mnt" "$installesd_path" + + # Convert BaseSystem.dmg + local basesystem_path="$installer_path/Contents/SharedSupport/BaseSystem.dmg" + + hdiutil convert -quiet "$basesystem_path" -format UDRW -o "$WORK_DIR/BaseSystem_converted.dmg" + + # Increase size + sudo hdiutil resize -size 9g "$WORK_DIR/BaseSystem_converted.dmg" + + # Mount the converted DMG + DISK_ID=$(hdiutil attach -nobrowse -mountpoint "$WORK_DIR/BaseSystem_mnt" "$WORK_DIR/BaseSystem_converted.dmg" | grep -o '/dev/disk[0-9]*' | head -1) + diskutil rename "${DISK_ID}s1" "$volume_name" + + # Remove the stub installer app + rm -rf "$WORK_DIR/BaseSystem_mnt/$(get_installer_app_name $version_num).app" + + # Copy actual installer app from /Applications + cp -R "$installer_path" "$WORK_DIR/BaseSystem_mnt/" + + # Extract the exact version number and append it to the file name + local exact_version_number=$(defaults read "$WORK_DIR/BaseSystem_mnt/System/Library/CoreServices/SystemVersion" ProductVersion) + if [ "$IMAGE_FORMAT" == "dmg" ]; then + FINAL_OUTPUT_PATH="${output_file%.dmg}_$exact_version_number.dmg.iso" + else + FINAL_OUTPUT_PATH="${output_file%.iso}_$exact_version_number.iso" + fi + + # Unmount + detach_disk "$WORK_DIR/InstallESD_mnt" + detach_disk "$DISK_ID" && DISK_ID="" + + # Create final image + if [ "$IMAGE_FORMAT" == "dmg" ]; then + # Optimize DMG file size + log_info "Optimizing DMG file size..." + sudo hdiutil resize -size min "$WORK_DIR/BaseSystem_converted.dmg" + + # Move to output + log_info "Move to $FINAL_OUTPUT_PATH" + mv -f "$WORK_DIR/BaseSystem_converted.dmg" "$FINAL_OUTPUT_PATH" + else + log_info "Converting to ISO format..." + sudo hdiutil makehybrid -quiet -ov -hfs -udf -default-volume-name "$volume_name" "$WORK_DIR/BaseSystem_converted.dmg" -o "$FINAL_OUTPUT_PATH" + fi +} + create_iso_10_12_and_later() { local installer_path="$1" local output_file="$2" local version_num="$3" + # macOS Sierra and Catalina 'createinstallmedia' fails when running on Apple silicon + # Redirecting to alternative method + if [[ "$CPU_ARCH" == "arm64" ]]; then + if [[ "$version_num" == "10.12" ]]; then + create_iso_10_9_10_11 \ + "$installer_path" \ + "$output_file" \ + "$(get_installer_app_name "$version_num")" \ + "$version_num" + return $? + elif [[ "$version_num" == "10.15" ]]; then + create_iso_dmg_10_15_alt_method \ + "$installer_path" \ + "$output_file" \ + "$(get_installer_app_name "$version_num")" \ + "$version_num" + return $? + fi + fi + log_info "Creating macOS $(get_codename $version_num) ISO image..." echo "" # Create sparse image - hdiutil create -size 20g -volname "$(get_codename $version_num)_iso" -fs HFS+ -type SPARSE -attach "$WORK_DIR/installer.sparseimage" >/dev/null 2>&1 + hdiutil create -quiet -size 20g -volname "$(get_codename $version_num)_iso" -fs HFS+ -type SPARSE -attach "$WORK_DIR/installer.sparseimage" DISK_ID=$(diskutil list | grep $(get_codename $version_num)_iso | head -1 | awk '{print $NF}' | sed 's/s[0-9]*$//') # Prepare createinstallmedia command local cmd="sudo '$installer_path/Contents/Resources/createinstallmedia' --volume /Volumes/$(get_codename $version_num)_iso --nointeraction" - + # For macOS 10.12, need to patch Info.plist # For macOS 10.10-10.12, need to add --applicationpath if [ "$version_num" == "10.12" ]; then @@ -948,7 +1177,7 @@ create_iso_10_12_and_later() { sync && sleep 5 # Extract the exact version number and append it to the file name - exact_version_number=$(defaults read "/Volumes/$(get_installer_app_name "$version_num")/System/Library/CoreServices/SystemVersion" ProductVersion) + local exact_version_number=$(defaults read "/Volumes/$(get_installer_app_name "$version_num")/System/Library/CoreServices/SystemVersion" ProductVersion) FINAL_OUTPUT_PATH="${output_file%.iso}_$exact_version_number.iso" # Restore Info.plist @@ -962,13 +1191,34 @@ create_iso_10_12_and_later() { # Create ISO from sparse image log_info "Converting to ISO format..." - sudo hdiutil makehybrid -ov -hfs -udf "$WORK_DIR/installer.sparseimage" -o "$FINAL_OUTPUT_PATH" + sudo hdiutil makehybrid -quiet -ov -hfs -udf "$WORK_DIR/installer.sparseimage" -o "$FINAL_OUTPUT_PATH" } create_dmg_10_10_and_later() { local installer_path="$1" local output_file="$2" local version_num="$3" + + # macOS Catalina, Sierra, El Capitan, and Yosemite 'createinstallmedia' fails when running on Apple silicon + # Redirecting to alternative method + if [[ "$CPU_ARCH" == "arm64" ]]; then + if [[ "$version_num" =~ ^10\.1[012]$ ]]; then + create_dmg_10_9_to_10_12_alt_method \ + "$installer_path" \ + "$output_file" \ + "$(get_installer_app_name "$version_num")" \ + "$version_num" + return $? + elif [[ "$version_num" = "10.15" ]]; then + create_iso_dmg_10_15_alt_method \ + "$installer_path" \ + "$output_file" \ + "$(get_installer_app_name "$version_num")" \ + "$version_num" + return $? + fi + fi + log_info "Creating macOS $(get_codename $version_num) DMG image..." echo "" @@ -993,7 +1243,7 @@ create_dmg_10_10_and_later() { esac # Create DMG disk image - hdiutil create -size $dmg_size -volname "$(get_codename $version_num)_dmg" -fs HFS+ -type UDIF -attach "$WORK_DIR/installer.dmg" >/dev/null 2>&1 + hdiutil create -quiet -size $dmg_size -volname "$(get_codename $version_num)_dmg" -fs HFS+ -type UDIF -attach "$WORK_DIR/installer.dmg" DISK_ID=$(diskutil list | grep $(get_codename $version_num)_dmg | head -1 | awk '{print $NF}' | sed 's/s[0-9]*$//') # Prepare createinstallmedia command @@ -1054,8 +1304,8 @@ create_dmg_10_10_and_later() { done # Extract the exact version number and append it to the file name - exact_version_number=$(defaults read "/Volumes/$(get_installer_app_name "$version_num")/System/Library/CoreServices/SystemVersion" ProductVersion) - FINAL_OUTPUT_PATH="${output_file%.dmg}_$exact_version_number.dmg" + local exact_version_number=$(defaults read "/Volumes/$(get_installer_app_name "$version_num")/System/Library/CoreServices/SystemVersion" ProductVersion) + FINAL_OUTPUT_PATH="${output_file%.dmg}_$exact_version_number.dmg.iso" # Unmount detach_disk "$DISK_ID" && DISK_ID="" @@ -1064,7 +1314,7 @@ create_dmg_10_10_and_later() { log_info "Final optimization..." sudo hdiutil resize -size min "$WORK_DIR/installer.dmg" - # Move to output + # Move to output and append .iso extension mv -f "$WORK_DIR/installer.dmg" "$FINAL_OUTPUT_PATH" } @@ -1138,17 +1388,6 @@ main() { log_info "Output path:${GREEN} $OUTPUT_PATH ${NC}" echo "" - # Check if trying to install legacy macOS on ARM64 -# if [[ "$VERSION_NUM" =~ ^10\.(7|8|9|10|11|12)$ ]]; then -# local cpu_arch=$(uname -m) -# if [ "$cpu_arch" == "arm64" ]; then -# log_error "Cannot create installer for macOS $VERSION_NUM on Apple silicon" -# log_error "Legacy macOS installers (10.7-10.12) require Intel (x86_64) Macs" -# log_error "Please use an Intel Mac to create installers for these versions" -# exit 1 -# fi -# fi - # Create work directory WORK_DIR=$(mktemp -d) log_info "Working directory:${CYAN} $WORK_DIR ${NC}" @@ -1185,7 +1424,7 @@ main() { if [ "$IMAGE_FORMAT" == "iso" ]; then case "$VERSION_NUM" in "10.7"|"10.8") - create_iso_10_7_10_8 "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; + create_iso_dmg_10_7_10_8 "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; "10.9"|"10.10"|"10.11") create_iso_10_9_10_11 "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; *) @@ -1194,9 +1433,9 @@ main() { else case "$VERSION_NUM" in "10.7"|"10.8") - create_dmg_10_7_10_8 "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; + create_iso_dmg_10_7_10_8 "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; "10.9") - create_dmg_10_9 "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; + create_dmg_10_9_to_10_12_alt_method "$INSTALLER_PATH" "$OUTPUT_PATH" "$VOLUME_NAME" "$VERSION_NUM" ;; *) create_dmg_10_10_and_later "$INSTALLER_PATH" "$OUTPUT_PATH" "$VERSION_NUM" ;; esac @@ -1232,7 +1471,7 @@ main() { else log_info "This DMG image is intended for:" log_info " - Flash to USB drive using Rufus (Windows) or dd (Linux)" - log_info " - Can also be used with virtual machines (requires conversion to .vhdx for Hyper-V or .vmdk for VMware)" + log_info " - Can also be used with virtual machines (requires conversion to .vhd for Hyper-V or .vmdk for VMware)" log_info " - Add to the VM as a virtual hard drive" echo "" fi @@ -1244,53 +1483,50 @@ main() { # Show usage if -h or --help is passed if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then - echo "╔══════════════════════════════════════════════════════════════════════════════╗" - echo "║ mkmaciso – the ultimate tool for creating macOS installer ISO and DMG images ║" - echo "╚══════════════════════════════════════════════════════════════════════════════╝" - echo "" - echo "Usage: $0 [VERSION] [FORMAT] [OUTPUT_PATH]" - echo " $0 # Run with no arguments to enter interactive mode" - echo "" - echo "Parameters:" - echo " VERSION - macOS version (number or codename), default: 26 (Tahoe)" - echo "" - echo " FORMAT - Image format: iso or dmg, default: iso" - echo "" - echo " OUTPUT_PATH - Output file path, default: ./macOS_." - echo "" - echo "Interactive Mode:" - echo " Run without any parameters to use the interactive menu." - echo "" - echo "Supported versions:" - echo " 10.7 (Lion) 10.14 (Mojave)" - echo " 10.8 (Mountain Lion) 10.15 (Catalina)" - echo " 10.9 (Mavericks) 11 (Big Sur)" - echo " 10.10 (Yosemite) 12 (Monterey)" - echo " 10.11 (El Capitan) 13 (Ventura)" - echo " 10.12 (Sierra) 14 (Sonoma)" - echo " 10.13 (High Sierra) 15 (Sequoia)" - echo " 26 (Tahoe)" - echo "" - echo "Examples:" - echo " $0 # Interactive mode" - echo " $0 14 # Create macOS Sonoma ISO in current directory" - echo " $0 14 dmg # Create macOS Sonoma DMG in current directory" - echo " $0 sonoma dmg ~/Desktop/Sonoma.dmg # Create Sonoma DMG on Desktop" - echo "" - echo "Requirements:" - echo " - macOS 11 (Big Sur) or later for create macOS 10.13+ image" - echo " - Internet connection for downloading installers" - echo " - Sufficient disk space (~20-30GB temporary, final size varies)" - echo " - Administrator privileges (sudo)" - echo " - Note: On Apple silicon Macs only the macOS version that originally" - echo " shipped with your device (or newer) can be download using this script" - echo "" + cat << 'EOF' +╔══════════════════════════════════════════════════════════════════════════════╗" +║ mkmaciso – the ultimate tool for creating macOS installer ISO and DMG images ║" +╚══════════════════════════════════════════════════════════════════════════════╝" + +Usage: + mkmaciso [VERSION] [FORMAT] [OUTPUT_PATH] + mkmaciso # Interactive mode + +Parameters: + VERSION macOS version number or codename, e.g. 26 or Tahoe + FORMAT iso or dmg (default: iso) + OUTPUT_PATH Output file path (default: ./macOS_.) + +Supported versions: + 10.7 Lion 10.14 Mojave + 10.8 Mountain Lion 10.15 Catalina + 10.9 Mavericks 11 Big Sur + 10.10 Yosemite 12 Monterey + 10.11 El Capitan 13 Ventura + 10.12 Sierra 14 Sonoma + 10.13 High Sierra 15 Sequoia + 26 Tahoe + +Examples: + mkmaciso Interactive mode + mkmaciso 14 Create Sonoma ISO + mkmaciso 14 dmg Create Sonoma DMG + mkmaciso sonoma dmg ~/Desktop/out.dmg Create Sonoma DMG at specified path + +Requirements: + - macOS 11 (Big Sur) or later for create macOS 10.13+ image + - Internet connection for downloading installers + - Sufficient disk space (~20-40GB temporary, final size varies) + - Administrator privileges (sudo) + - For best results, run this on Intel Macs +EOF exit 0 fi -# Check if running in interactive mode (no parameters) +# Check if running in interactive mode with piped (no parameters) if [ $# -eq 0 ]; then if [ -p /dev/stdin ] || [ ! -t 0 ]; then + clear log_error "Interactive mode unavailable when piped" log_info "Usage: curl -sL | bash -s [FORMAT] [OUTPUT]" echo ""