Insert your USB drive and open (Applications > Utilities). Select your USB drive from the sidebar. Click Erase and format it as follows:
diskutil unmountDisk /dev/diskX
: Press Enter , type your Mac user password, and press Enter again. Type Y to confirm erasing the drive. Case B: If the DMG is a Raw BaseSystem Image create mac os x bootable usb installer from dmg