I needed to create a High Sierra ISO for use with VirtualBox – which worked successfully.
The following method worked successfully on both Sierra and High Sierra systems.
The High Sierra installation files can be downloaded from the App Store when using a Mac or Hackintosh. I usually download a fresh copy of High Sierra after each update release from Apple.
Open Terminal with Spotlight, or by navigating to the Utilities | Applications folder and click the Terminal.app
Enter the following lines into Terminal to create the ISO for High Sierra.
hdiutil create -o /tmp/HighSierra.cdr -size 5300m -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
A usable ISO should be created if no errors are encountered.
To use these commands in a script file, I would suggest using the && operator to chain the commands together. When the && operator is used the next command is run if and only if the preceding command exited without errors.
hdiutil create -o /tmp/HighSierra.cdr -size 5300m -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