6

After a recent OS X update (currently Sierra, 10.12.3) the normal user on this machine is no longer in the admin group.

I don't know what caused the account to be removed from that group; how can I get it back?


Advice found via I don't have administrator account on my mac suggests booting to Single-User mode, and using the dscl command:

dscl . -append /Groups/admin GroupMembership username

This fails immediately:

Could not read path: path = /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist, error = 2: No such file or directory

and no change in groups occurs. Apparently I can't expect dscl to work in Single-User mode.

So what should I do, to re-add the username to the admin group?

2
  • None of the answers mention a dscl .. command - a link in a comment does though. You have to add some details (i.e. what have you done so far and what are you trying to do) to your question.
    – klanomath
    Feb 6, 2017 at 10:38
  • Why don’t you follow this answer to remove the .AppleSetupDone file. Easy-peasy make a new admin then r-grant admin as needed.
    – bmike
    May 1, 2018 at 1:44

2 Answers 2

5

After starting to Single User Mode enter:

/sbin/fsck -fy
/sbin/mount -uw /

Launch opendirectoryd:

launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist

Then enter (replacing username with the real user name):

dscl . -append /Groups/admin GroupMembership username

You will get an error "...com.apple.DirectoryServicesLocal.plist doesn't exit anymore ..." - ignore it! Your user should still get promoted to an admin user.

Enter exit to boot to the GUI.

2
  • This worked for me even though both launchctl and dscl spewed some errors.
    – xrisk
    Dec 12, 2017 at 20:40
  • Yikes. Recovery has a way of resetting the passwords so long as disk isn't encrypted, and you know the firmware password if there is one.
    – Jahhein
    Apr 26, 2018 at 18:43
4

What's easiest is to add a new admin account. To do this:

1. Boot into single user mode

After power on, immediately press and hold Command-S

your system will boot showing a lot more details, and drop you on a shell prompt.

NOTE: if your system has a firmware password this will fail. You need to first remove that password temporarily. See here: https://discussions.apple.com/thread/4347468

2. Make the filesystem writable

issue the command mount -uw /

3. Remove the file indicating the system has been setup previously

issue the command rm /var/db/.AppleSetupDone

4. Let the boot continue

press Control-D or type reboot to make the system continue the boot and/or reboot (which doesn't matter)

5. Add a new temporary user account in the GUI

The system now boots and thinks it's unconfigured and will ask in a graphical user interface the details to create a new admin account, just like it did when it was new out of the box. Make sure it's a NEW account. And don't transfer data or anything like that.

It will also log you in as that user

6. fix your old account You can now make changes to the original user and give it admin rights again etc.

7. remove temp admin account Log out en log in with your fixed account and remove the temporarily created admin account.

More info:

Please see here as well: I don't have administrator account on my mac

You must log in to answer this question.

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