Most of the time you never need a macOS installer on a stick. Updating and reinstalling work fine from the Mac itself. But when those fail, or when you want to set up several Macs without downloading the same multi-gigabyte installer every time, a bootable USB drive is the thing I’d want in a drawer. Apple hides the tool for it inside the installer app.
First download the full installer from the App Store. It lands in Applications as an app called Install macOS plus the version name. Then plug in a USB drive and rename it to MyVolume, because that’s the name Apple’s command expects. For macOS 27 Golden Gate it looks like this:
sudo /Applications/Install\ macOS\ 27\ Golden\ Gate.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
Type your admin password, confirm with Y, and wait. When Terminal says the install media is available, the stick is renamed to match the installer. For an older version you just swap the app name, for example Install\ macOS\ Tahoe.app for macOS Tahoe 26. Apple’s support page lists the exact line for every release back to El Capitan.
To use it on an Apple silicon Mac like my MacBook Pro M5 Pro: shut down, plug in the stick, then press and hold the power button until the startup options appear. Pick the installer and click Continue.
Now the caveats, because there are a few. The command erases the whole drive and formats it as Mac OS Extended (Journaled), so double-check which stick is plugged in. A 32GB drive is plenty. You usually have to download the installer on a Mac that can run that macOS version. And the Mac you install on needs an internet connection, since the installer fetches firmware and model-specific bits during setup. So it’s not a fully offline rescue kit, more a way to skip the long download.
Further reading: Create a bootable installer for macOS (Apple Support)