I wanted to change the name of my user as well as its home directory. Looking for a way to do this, I stumbled upon this support document.

I did everything as described there, but since I restarted the computer, all that happened is, that I'm not an admin anymore.

I can't unlock anything under System Preferences > Users & Groups, as well as I'm unable to edit /etc/sudoers/

What went wrong? whoami still shows my previous username..

How can I fix this mess? Am I screwed now?

macOS 10.13.4 btw

  • Please post of a picture of the menu when you navigate to System Preferences>Users & Groups>Right Click on your user>Advanced Options. Note: You may not be able to do this before doing what is suggested in my answer
    – JBis
    Apr 24 '18 at 12:15
  • @Josh I just saw this comment, but already recovered sudo rights on my old user. The behavior is still strange tho, because nothing changed, except I got kicked out of sudoers
    – dschu
    Apr 24 '18 at 12:21

From I don't have administrator account on my mac

  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. Mount the drive by typing /sbin/mount -uw / then ↩ enter.

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

  4. Reboot by typing reboot then ↩ enter.

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

This should allow you to create a new admin user.

I will edit this answer to include a fix for your old user soon.

  • Yes! Thank you, this saved my day and my MacBook from getting fired through the window. 😅
    – dschu
    Apr 24 '18 at 12:16
  • @dschu Glad I could help, If you would like help fixing your old user, please post of a picture of the menu when you navigate to System Preferences>Users & Groups>Right Click on your user>Advanced Options.
    – JBis
    Apr 24 '18 at 12:21
  • I've updated my question and included a picture
    – dschu
    Apr 24 '18 at 12:30
  • @dschu Thanks for the picture. May help other users fix there problems by comparing there settings.
    – JBis
    Apr 24 '18 at 12:33
  • fix for old user?
    – DimiDak
    Mar 2 '20 at 19:30

Another way is:

First write the command on terminal:

pkgutil --file-info /usr/bin/sudo

After that follow the steps below:

  1. Restart the OSX with holding down keys Cmd-S
  2. Choose in the menu "Utilities" the option "Terminal"
  3. Force check the file with command: /sbin/fsck/ -fy
  4. Mount the file system with command: /sbin/mount -uw /
  5. Change the permission on sudo: chmod 4511 /usr/bin/sudo
  6. Now reboot the computer with command: reboot
  • How does this recreate the admin account? What is the purpose of running pkgutil --file-info /usr/bin/sudo?
    – nohillside
    Mar 8 '19 at 9:16

You must log in to answer this question.

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