2

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

0
5

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.

  1. 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.

  2. When the macOS Utilities window appears, select Disk Utility and continue.

  3. Select your startup disk in the pane to the left and take note of its name. (It is usually named Macintosh HD). If the name is greyed out, or if you see the text "Not Mounted", click the Mount button. If requested, select your username and enter your password. Make sure that the startup disk is mounted before continuing.
  4. Quit Disk Utility. The macOS utility window should appear.
  5. Go to the top menu bar (where the Apple logo resides) and click on Utilities. Select Terminal from the drop-down menu.
  6. Enter the following command, exactly as shown. Substitute "startup disk" with the actual name of your startup disk.

      rm '/Volumes/Macintosh HD/var/db/.AppleSetupDone'
    
  7. 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.

3
  • rm '/Volumes/Macintosh HD/var/db/.AppleSetupDone' via Single users mode, no longer works in Catalina.Anyone know a alternate or fix? – Digitol Sep 19 '20 at 19:07
  • @Digitol try mount -uw / and mount -uw /volumes/Macintosh\ HD/? – Joy Jin Sep 20 '20 at 3:46
  • Don't confuse the /var/db/ in the Boot Recovery image with your actual /Volumes/Macintosh HD/var/db/. This had me stumped for a while. – Sridhar Sarnobat May 30 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .