Apple - Why is sudo taking way too long?

ErikMH's answer gave me the idea to first just try to revert the sudoers file, without reverting/upgrading my whole system again. So in short:

  1. Run this to get a root shell: sudo -s
  2. Make a copy of /private/etc/sudoers
  3. Run: cp /private/etc/sudoers\~orig /private/etc/sudoers
  4. Fix permissions by running: chmod 440 /private/etc/sudoers ; chown root:wheel /private/etc/sudoers
  5. Move any files in /private/etc/sudoers.d/ away from there
  6. Test out sudo in another terminal
  7. Don't forget to exit this shell to prevent inadvertently running commands as root when you don't mean to

Now running sudo should work again.

Next step is to check the differences between the old sudoers file (you copied away in step 2) and the current one and add those changes step by step back to /private/etc/sudoers or /private/etc/sudoers.d/, each time running a command using sudo to check if the change breaks it.

In my case, I had specified a nonexistent group in the sudoers file. Correcting that fixed my issue.


This can occur when upgrading to 10.12.4 if you’ve ever edited the /private/etc/sudoers file.

Easiest solution is:

  1. Drop back to a previous version of the system (you always clone your system before updating, right?)
  2. Delete /private/etc/sudoers
  3. Copy /private/etc/sudoers~orig to sudoers
  4. Reset the ownership of sudoers to system/root — read-only
  5. Upgrade the system to 10.12.4