78

On my mac I have 2 accounts and the both are normal account. So in this moment I don't have a Administrator account, only one that was in the past a administrator, but now is not.

How I can have again a Administrator account?

5
  • 4
    How did the account become a non admin one?
    – mmmmmm
    Commented Dec 31, 2014 at 14:38
  • Might be worth going into the user/accounts settings page and seeing if the account that "was" admin can be set back to being admin w/ the rights you currently have. I wasn't aware that OSX allowed you to de-admin all accounts. Commented Dec 31, 2014 at 17:40
  • 1
    The answers in this question don't work for me. I've described further at apple.stackexchange.com/questions/271873/…
    – bignose
    Commented Feb 6, 2017 at 7:33
  • I'm on El Capitan and I'm working through this now so I can get to High Sierra. I can't install the new OS without resolving this.
    – PaulR
    Commented Dec 22, 2017 at 21:18
  • FWIW: to trigger not having any admin account anymore, on High Sierra it's enough to try to rename too much of the only account in the control panel.
    – user147148
    Commented Apr 30, 2018 at 0:11

5 Answers 5

91

You can create a new administrator account by restarting the Setup Assistant:

  1. Boot into Single User Mode: Start/restart your Mac. As soon as you hear the startup tone, press and hold + S until you see a black screen with white lettering. (If you end up back on the login screen after a flash of the black screen with white lettering, enter your password and it will return to the black screen.)

  2. Check and repair the drive by typing /sbin/fsck -fy then ↩ enter - as directed by the on-screen text.

  3. Mount the drive as read-write by typing /sbin/mount -uw / then ↩ enter.

  4. Remove the Apple Setup Done file by typing rm /var/db/.AppleSetupDone then ↩ enter.

  5. Reboot by typing reboot then ↩ enter.

  6. Complete the setup process, creating a new admin account.

Note that this may result in the new account being logging in automatically when the system is restarted, replacing whatever account may have been set to automatically log in previously. If you need to retain access to the original account without knowing its password, this may mess that up.

3
  • 2
    Make note of the / at the end of the command in point 3. Easy to miss.
    – Dave
    Commented Apr 26, 2019 at 7:49
  • 3
    Starting in macOS Catalina (10.15), macOS uses a split volume format, which complicates this procedure. Change the mount command to mount -uw /System/Volumes/Data, and the rm command to rm /System/Volumes/Data/private/var/db/.AppleSetupDone. Also, some newer Macs disallow Single-User mode, so you have to use Recovery mode (with different commands) instead. Commented Apr 16, 2021 at 21:32
  • 1
    Also, don't confuse the /var/db/ in the Boot Recovery image with your actual /Volumes/Macintosh HD/var/db/ which you need to mount if you are doing this from the recovery terminal. Commented May 30, 2021 at 7:50
24

Boot off the recovery partition, open up terminal, and type

resetpassword

That should bring up a dialog that will allow you to change your password and, maybe, set the account to admin. If you cannot set an account to admin, then you will need to reboot into single user mode (hold Cmd-S while starting up your Mac). When you get to the command line (black screen, white text) type:

mount -uw /
rm /var/db/.AppleSetupDone

This makes the file system writeable, and then removes the file that tells OS X that you've setup the system. Hit Ctrl-D" to continue your boot and you should get the "Welcome to Macintosh" startup and you will be able to setup a NEW account (make sure it is a new account). This account will be an admin account.

2
  • 1
    resetpassword will not help (I tried), but removing the .AppleSetupDone works like a charm
    – user147148
    Commented Apr 30, 2018 at 0:09
  • Not helpful for those who do not know how to boot off the recovery partition. Commented Jun 2, 2018 at 22:21
12

There are several ways to regain/recreate administrator privileges on a Mac.

  1. The administrator account exists, but the password is forgotten:

Boot into Recovery Partition, choose Terminal from the Utilities menu and type following:

resetpassword

This will launch the Reset Password app with which you can select an account and set a new password for it, thus enabling login for it.

Reset Password app

Resetting the password does NOT change the password of the account's keychain file, so accessing data in the keychain still requires the original password.

  1. The administrator account does not exist and/or we want to create a new admin with the Setup Assistant

The goal is to remove a flag file /var/db/.AppleSetupDone which tells macOS that the Setup Assistant has already completed. If the file is missing macOS will launch the Setup Assistant which includes the creation of a new account with administrative privileges (same as on first boot of a new Mac). Note that this may result in the new account being logging in automatically when the system is restarted, replacing whatever account may have been set to automatically log in previously. If you need to retain access to the original account without knowing its password, this may mess that up.

You can make Setup Assistant run in (at least) three ways:

a) use Terminal in Recovery. First you boot in Recovery Partition (CmdR at boot) and select Disk utility from the Utilities window. Select your system volume (usually named Macintosh HD) and click Mount button on the toolbar. Now the volume is read/write. Close Disk Utility, launch Terminal from the menu and type following command:

rm /var/db/.AppleSetupDone

Press Enter, quit Terminal and restart your Mac. When the system boots, Setup Assistant will be shown and you will be prompted to create a new administrative account.

b) use Single User Mode. First you boot in Single User Mode (CmdS at boot). When the system boots up and prompt #root is displayed type following commands:

single user mode

/sbin/mount -uw /
rm /var/db/.AppleSetupDone
exit

When the system boots, Setup Assistant will be shown and you will be prompted to create a new administrative account.

c) use Target Disk mode with another computer

target disk mode

If you have another Mac available, you can use Target Disk Mode (T at boot) and connect FireWire, Thunderbolt or USB-C cable between the Macs. On the other Mac you will see a yellow icon representing an external disk (but is actually the internal disk of your Mac in Target Disk Mode) which you can access with full read/write capabilities. Note the yellow volume name (usually Macintosh HD) and type following in Terminal (with appropriate volume name entered):

rm /Volumes/Macintosh\ HD/var/db/.AppleSetupDone

Eject the yellow volume and use power button to shutdown and restart your Mac. When the system boots, Setup Assistant will be shown and you will be prompted to create a new administrative account.

  1. use Single User Mode and use command line tools to directly create a new user and make it a member of administrator group:

First you boot in Single User Mode (CmdS at boot). When the system boots up and prompt #root is displayed type following commands:

single user mode

/sbin/mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
dscl . -create /Users/joeadmin
dscl . -create /Users/joeadmin UserShell /bin/bash
dscl . -create /Users/joeadmin RealName "Joe Admin" 
dscl . -create /Users/joeadmin UniqueID "510"
dscl . -create /Users/joeadmin PrimaryGroupID 20
dscl . -create /Users/joeadmin NFSHomeDirectory /Users/joeadmin
dscl . -passwd /Users/joeadmin password 
dscl . -append /Groups/admin GroupMembership joeadmin
dseditgroup -o edit -a joeadmin -t user admin
exit

This will create an account "joeadmin", account ID 510, with password "password" which will be an administrator.

6
  • Not helpful if you do not know how to boot in to the recovery partition. Commented Jun 2, 2018 at 22:21
  • 2
    @JaydenLawson steps needed to boot into Recovery Partition are listed in a) section of my answer
    – boris42
    Commented Jun 3, 2018 at 2:14
  • 1
    running this command suggested in a) rm /var/db/.AppleSetupDone showing this error message: "No such file or directory"
    – Hemang
    Commented Jul 23, 2018 at 9:03
  • 3
    A note to single-user mode: If File Vault is enabled the system shows a black screen with white text for a moment and goes to login screen. This is needed to unlock the disk, so just enter your password and after thet you will see the promt.
    – MightySeal
    Commented Oct 4, 2018 at 8:20
  • 2
    Starting in macOS Catalina (10.15), macOS uses a split volume format, which complicates things. To delete .AppleSetupDone in Single-User mode, change the mount command to mount -uw /System/Volumes/Data, and the rm command to rm /System/Volumes/Data/private/var/db/.AppleSetupDone. In Recovery and Target Disk modes, use rm /Volumes/Macintosh\ HD\ -\ Data/private/var/db/.AppleSetupDone (and type it carefully). Commented Apr 16, 2021 at 21:50
5

You can boot your Mac into single user mode by holding Cmd-S key while the system startup

  1. mount when read & write mode mount -uw /
  2. you can create admin group and account by using dscl utility

PS: This procedure does require you to type a fair number of commands, you can alternatively use the OS X setup assistant for recreating the admin account. To do so, after booting to Single User mode and setting the file system for write access (see above), then run the following command:

rm /var/db/.AppleSetupDone

2
  • 1
    nelson, I suggest improving your answer by adding the actual dscl commands that he would need to use. Good response but it could be better. I had a hell of a time recently myself trying to figure it out, a good answer on this site would have helped immensely.
    – Harv
    Commented Jan 6, 2015 at 17:58
  • 1
    I used this page recently after I accidentally made myself a standard user - hackmac.org/tutorials/from-standard-to-administrator
    – Karthik T
    Commented Dec 23, 2015 at 4:44
3

Answer for 2022/Big Sur:

Doing this in Single User mode may still be possible, but for several reasons I found it way too difficult*.

I found deleting the .AppleSetupDone file from Recovery to be far easier:

  • Reboot holding down Cmd-R to enter Recovery

  • open Terminal from the Utilities menu

  • Enter the following (assuming your boot disk is called 'Macintosh HD')

    rm /Volumes/Macintosh\ HD/var/db/.AppleSetupDone
    
  • restart the computer and create a new admin user via the Setup Assistant

  • (optionally, if you had on old admin user who got somehow "de-adminned", promote that user to an admin and remove the new admin account)

* mounting disks r/w is now four commands in two sections and a bunch of extra info scrolled past while I was doing them, so the instructions scrolled off the top of the screen before I could finish them! And you can't copy/paste. Also dscl failed to do anything, complaining about missing files

1
  • This is currently the best method which I just used successfully on Monterey 12.5. I would add that you need to mount the main OS volume as read-write first using: mount -uw /Volumes/Macintosh\ HD. - My OS volume was mounted as read-only by default in Recovery. This was the only additional command required.
    – ChrisW
    Commented Jul 21, 2022 at 9:02

You must log in to answer this question.

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