I accidentally deleted my admin account from directory utilities system. Now I'm using my standard account to login, in the system preferences there is no admin account but when I click the lock it requires admin name and password. I did some research and found out that activating Setup Assistant allow me to create my new admin account. I tried many ways but it ended up automatically log in to my current standard account every time I "reboot" my Mac.
When I enter mount -uw /
it shows: "volume couldn't be mounted" and "failed with 77"
rm /var/db.AppleSetupDone
echoes: "Override root…AppleSetupDone?" and "no such file or directory"
Please help me fix this
Best Answer
You can use an exploit in macOS to re-run Setup Assistant. This will allow you to create a new administrator account, which you can then use to repair your real account.
Restart your Mac while holding down Command+ R. Release the keys when the Apple logo and a progress bar appear. This will boot Recovery Mode.
When the macOS Utilities window appears, select Disk Utility and continue.
Enter the following command, exactly as shown. Substitute "startup disk" with the actual name of your startup disk.
The command line should return with no response. Restart your Mac and it will launch Setup Assistant. If your Mac has FileVault enabled, you'll need to log in after the restart.
You'll be prompted to create a new administrator account. Give it a separate name to easily distinguish it from your real account. When done, complete the rest of the Assistant. I have done this in Catalina and tested. It works perfectly.