os/macos/ SingleUserMode
Hold Command-S when booting.
Create New Admin Account
Apparently Apple closed this loophole see here as macs with a T2 chip don't support Single User Mode. But see here for more. Boot in single user mode (Command-S). Then at the command prompt type (the # comments
don't need to be typed):
/sbin/fsck -fy # check drive for errors
/sbin/mount -uw /
rm /var/db/.AppleSetupDone
and the reboot. This is good for old macs.