Admin account accidentally deleted

After having taken my MacBook Pro to Apple Assistance because of a hardware problem it had, the Technician had set a new admin account with a password I had to change after first login. I changed the password successfully, but I wanted to change the name of the admin account too. I followed the procedure as explained on Apple Support website, but something went wrong and now the only account I have is not an administrator but turned into a standard and I can't manage to make it an admin.


How can I fix this?

MacBook Pro

Posted on Dec 22, 2018 8:49 AM

Reply
2 replies

Dec 23, 2018 6:45 PM in response to alessiatoffa

Hi alessiatoffa,


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.


If your MacBook Pro was made in 2018, or if a firmware password is set on your Mac:


  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).
    1. 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 Utilities 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.
    1. rm '/Volumes/startup disk/var/db/.AppleSetupDone'
  7. The command line should return with no response. Restart your Mac to launch Setup Assistant, and see Fixing your normal account. If your Mac has FileVault enabled, you'll need to log in after the restart.


If you have an older MacBook Pro without a firmware password


  1. Restart your Mac while holding down Command-S. Release the keys when white text appears on a black screen. This will boot Single User Mode.
  2. If the login window immediately appears, log into your account to continue. (Permissions will be ignored; you will be operating as the superuser, root.)
  3. When the white text stops moving, enter the below commands in order, exactly as shown:
    1. mount -uw /
    2. rm /var/db/.AppleSetupDone
    3. launchctl reboot
  4. Your Mac should immediately restart. If FileVault is enabled, log into your account to continue. Setup Assistant should then appear. See Fixing your normal account.


Fixing your normal account


  1. When Setup Assistant appears, progress through the Assistant until you're prompted to transfer data. Choose not to, and continue to the next screen.
  2. 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.
  3. You'll be automatically logged into the new administrator account. If you wish to restore administrative privileges to your real account, and optionally delete this one, keep reading.
  4. Reverse the changes you made on your real account. The correct procedure for changing your account name can be found here: https://support.apple.com/en-us/HT201548
  5. Open System Preferences and select Users and Groups. Click the padlock icon in the bottom left and authenticate with your temporary credentials.
  6. Select your real account, disable Parental Controls if necessary, and check the box next to "Allow user to administer this computer".
  7. Restart your Mac, and log into your real account.
  8. Go to Users and Groups in System Preferences, and click on the padlock in the bottom left corner. Authenticate with your own credentials.
  9. If desired, delete the temporary administrator account.


Hope this helps!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Admin account accidentally deleted

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.