This mounts the blank image so the system can see it.

He settled on a specialized script. As the terminal window flickered with lines of code, Elias watched the progress bar crawl. The script was busy:

For a moment, there was only a black screen. Then, the iconic white Apple logo appeared. A few minutes later, the screen erupted into the vibrant, sweeping colors of the Sonoma Valley wallpaper. The "Hello" screen blinked in a dozen languages.

hdiutil attach /tmp/Sonoma.dmg -noverify -mountpoint /Volumes/Sonoma

Finally, convert the DMG file on your desktop into an ISO file.

hdiutil create -o /tmp/Sonoma -size 13000m -volname Sonoma -layout SPUD -fs HFS+J

Partially. A self-converted ISO will often boot in UEFI-based virtualization platforms. However, it frequently fails because:

Here is a useful guide on how to get the macOS Sonoma ISO.