hdiutil convert /tmp/ElCapitan.dmg -format UDTO -o ~/Desktop/ElCapitan.iso

This creates a file named ElCapitan.iso.cdr on your Desktop.

Before we discuss the ISO download, let’s address compatibility. You should only install El Capitan if:

Important Note: Apple no longer actively supports El Capitan. The last security update was released in 2018. Do not use this as your daily driver for banking or sensitive data.

Once you have the official InstallMacOSX.dmg or the Install OS X El Capitan.app:

# Create a blank CDR image
hdiutil create -o ElCapitan -size 8g -layout SPUD -fs JHFS+