Unable to use sudo on OSX, getting sudo: unknown uid 501: who are you?

kashkar picture kashkar · Dec 6, 2016 · Viewed 18.8k times · Source

When I type sudo <command> in terminal I get sudo: unknown uid 501: who are you? and when I type su I get su: who are you?

I think I must have changed super user permissions somehow on my personal machine. I'm not able to use sudo commands now, and I've not been able to find any helpful solutions. Do I have to do something with my /etc/passwd file? Can I even modify that?

Answer

s g picture s g · Jan 4, 2017

FWIW - I simply had to install (via restart) the automatic updates that were downloaded and it was fixed. Logging out and back in didn't work.

It appears that simply restarting iterm2 may be sufficient, too, so that's probably a better place to start.