Im on macOS Mojave on my Mac. I deleted my admin and made my user to admin. Now, I have problems with permission of files in the system. Yosemite was able to repair disk permissions by pressing a button. On the new system you must use the command line. I just got error when I tried to repair it. By the way, I'm uid 501.

sudo /usr/libexec/repair_packages --verify --standard-pkgs /
sudo: /etc/sudoers is owned by uid 501, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

3 Answers 3


That command no longer exists since Sierra.

Apple recommend this as the current way to repair user permissions...

From Apple KB - Resolve issues caused by changing the permissions of items in your home folder

Reset permissions

If the issue started after changing the permissions of items in your home folder, reset permissions:

  1. From the Finder menu bar, choose Go > Home. Your home folder opens.
  2. Choose File > Get Info. An Info window for your home folder opens.
  3. If the Sharing & Permissions section at the bottom of the window isn't open, click the triangle in that section to open it.
  4. If the Lock button at the bottom of the window shows a closed lock lock , click the lock and enter an administrator name and password.
  5. Click the Action menu in the bottom corner of the window, then choose “Apply to enclosed items.” Click OK to confirm the action. A progress bar appears at the top of the window.

  1. When the progress bar completes, open the Terminal app, which is in the Utilities folder of your Applications folder.
  2. Paste or type this command in Terminal, then press Return:

    diskutil resetUserPermissions / `id -u\`

On U.S. keyboards, the ` character is just above the Tab key. After entering the diskutil command, if Terminal says that permissions reset on user home directory failed (error -69841), enter chflags -R nouchg ~ then enter the diskutil command again.

  1. When the process completes, quit Terminal.
  2. Restart the computer, then test to see if the issue is fixed.
  3. If the issue persists, reinstall macOS.
  • I did all of this! the permission have been reset but still stuck the same problem
    – Tahan
    Mar 21, 2019 at 16:34
  • 501 belongs to the first admin account on a machine. Best guess is you got the account swap wrong. I was hoping this might fix it. Think you'll have to see if you can set up a new admin account & fix it from there.
    – Tetsujin
    Mar 21, 2019 at 16:37
  • I tried to create new admin to fix it but did not work. I had to wipe out the hard drive and install fresh new mojave.
    – Tahan
    Mar 27, 2019 at 17:33

Could you tell us what's the output of the following command:

ls -l /etc/sudoers

From the output you're providing us, I think the access right on this files are not correct.

On my mac here I have the following:

ls -l /etc/sudoers
-r--r-----  1 root  wheel  2299 Jul 12  2015 /etc/sudoers

If that's not what you have, then it could be the issue. Do this to adjust permissions:

chown root:wheel /etc/sudoers
chmod 440 /etc/sudoers

And then try again you're command.

  • chown root:wheel /etc/sudoers chown: /etc/sudoers: Operation not permitted
    – Tahan
    Mar 21, 2019 at 16:33
  • I think the issue is attempting to change who is 501. It's left the sudoers in bad shape. Vain hope that the fix perms &/or reinstall would fix it, otherwise I'd guess it's make a new, working admin account & fix the sudoers list from that.
    – Tetsujin
    Mar 21, 2019 at 16:35
  • I even enable root user. It did not work.
    – Tahan
    Mar 21, 2019 at 16:41
  • If it's not working try to start in single user mode maybe? command+S during boot Or maybe you can do the same by booting on the recovery partition. I will try to do it on my mac to see if it's feasible
    – agm650
    Mar 21, 2019 at 20:44
  • I did command + r and install mojave but it never was able to reset the file system. I had to wipe out the hard drive
    – Tahan
    Mar 27, 2019 at 17:34

The problem usually arises when ownership for /etc/sudoers is not set correctly.

Step by Step guide to resolve the problem:

Step 1:

In Terminal run

cd /var/db/sudo/
ls -la

and check if the output on terminal includes this line

drwx------   3 root  wheel   102 Nov 24 00:57 ts

If it includes, fine, proceed to step 2. If not, note this thing in your mind, you will need it later.

Step 2:

  • Start up in recovery mode (Cmd+R during boot up)
  • Disk Utilities > Select Macintosh HD, and Mount
  • Close Disk Utilities
  • Utilities > Terminal
  • Run chown root:wheel /Volumes/Macintosh\ HD/etc/sudoers
  • If in step 1, the terminal output there was not what was required and you noted something in your mind in that step, run chown -R root:wheel /Volumes/Macintosh\ HD/var/db/sudo/ts/. No need to run this command if u noted nothing in your mind in step 1.
  • Reboot or Restart

Done! Enjoy!

Point to be noted: Actually chown root:wheel /etc/sudoers this is something actually we need to do but without recovery mode we will not be able to run this command. So the above steps worked for me for Mac OS Mojave 10.14.6.

  • What's the purpose of /var/db/sudo/ts/ and how does changing ownership of that directory relate to the ownership of sudoers? Also, I don't think the path in step 2 is correct.
    – nohillside
    Sep 25, 2019 at 11:23
  • @nohillside usually the culprit causing the the ownership issue for /etc/sudoers, also make the ownership of /var/db/sudo/ts/ corrupted. So it will be good to be sure that ownership of this is also set correctly otherwise you will not be able to execute sudo in your terminal. You are right, I mentioned the relative path, the excat path will be /Volumes/Macintosh\ HD/var/db/sudo/ts/ [answer edited] Sep 25, 2019 at 18:46

You must log in to answer this question.

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