sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

This method uses dd or asr (Apple Software Restore) to write the DMG directly to the USB drive. create mac os x bootable usb installer from dmg

– you'll need it for the next step.

Create Mac Os X Bootable - Usb Installer From Dmg

sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

This method uses dd or asr (Apple Software Restore) to write the DMG directly to the USB drive.

– you'll need it for the next step.