How to clean-install macOS Sonoma is explained here. However, there is an issue with the Sonoma 14.1 installer, and it gives an error message when asked to create a bootable USB stick.
% sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/Sonoma /Applications/Install macOS Sonoma.app does not appear to be a valid OS installer application.
So, it seems that you need to download Sonoma 14.0 first, create a bootable USB stick from it, do a clean install, and update the OS to the latest version.
% softwareupdate --fetch-full-installer --full-installer-version 14.0 % sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/Sonoma Ready to start. To continue we need to erase the volume at /Volumes/USB. If you wish to continue type(Y) then press return : Y Erasing disk: 0%... 10%... 20%... 30%... 100% Copying essential files... Copying the macOS RecoveryOS....