What result did hdiutil verify show?
A valid structure is required before extracting the installer.
Problems
No mountable file systems
Delete the damaged or incomplete file and download it again. Do not rename a ZIP, ISO, or RAR file to .dmg.
Image data corrupted
Delete the DMG, confirm that the Mac has enough free storage, and download a fresh copy over a stable connection.
Resource temporarily unavailable
Eject any mounted copy of the image, close Disk Utility and other apps using it, then verify again.
FAQ
Will creating the USB erase it?
Yes. createinstallmedia erases the selected USB. Copy its files elsewhere and disconnect other external disks first.
Can I copy the DMG directly to the USB?
No. A normal DMG is a container. Extract the full installer app and use createinstallmedia unless the trusted source explicitly documents the image as a complete bootable disk image.
Is 16 GB enough?
Apple says 16 GB is enough for most earlier macOS installers. A genuine 32 GB drive provides more margin and is the safer recommendation.
Can I use InstallESD.dmg or BaseSystem.dmg alone?
Not for the recommended process. They are usually components inside a complete installer and should not be treated as the full bootable installer.
Can an Apple silicon Mac boot Mojave?
No. Mojave is for Intel Macs. The destination Mac must officially support Mojave.
Why is Terminal not showing my password?
That is normal for sudo. Type the Mac administrator login password and press Return even though no dots or characters appear.