Here's how to do it from text commands and using a purpose-built software called WizDMG. To create a bootable macOS installation disk, you have to burn the DMG file to a USB drive as CD/DVD is not available for Mac computers. It can also help in situations where the operating system is corrupted or installation from app store shows errors. Rather than download and install a new OS from Apple's servers each time, it can be used for multiple installations on different machines.
Learning how to create a bootable macOS installation disk can be helpful in a variety of situations.