Warning
Create a Time Machine backup before major updates, disk operations, or security changes on macOS.
What you will achieve
Full macOS reinstall from USB when Recovery is unavailable or you want a known-good installer.
1) Build installer USB
softwareupdate --list-full-installers
sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/MyUSB
2) Boot from USB installer
- Apple Silicon: hold power button to Loading startup options.
- Intel: restart and hold Option.
3) Erase and install
- Open Disk Utility, show all devices, erase system volume group correctly (usually APFS, GUID).
- Run Install macOS and complete setup.