I have a usr/bin/sudo problem on my Mac (El Capitan).
It started when I ran into a permissions problem installing from NPM and followed their directions here: https://docs.npmjs.com/getting-started/fixing-npm-permissions
I found out that was a really stupid thing I did here:
/usr/bin/sudo must be owned by uid 0 and have the setuid bit set version .ubantu14.04 LTS
I open up my terminal and get:
malloc: * error for object 0x7fff38418900: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug [Process was terminated by signal 6]
This essentially kills my terminal and therefore my work.
I Command-S while rebooting to start in single user mode. I run
fsck -fy
and my hard drive appears to be OK. I then got to: http://osxdaily.com/2015/11/04/verify-repair-permissions-mac-os-x/ which tells me to fix the permissions as I have El Capitan and therefore cannot use Disk Utility for this. I run:
sudo /usr/linexec/repair_packages --verify -standard-pkgs /
The terminal spits back:
sudo: effective uid is not 0, is sudo installed setuid root?
I dig deeper: https://apple.stackexchange.com/questions/194854/sudo-effective-uid-is-not-0-is-sudo-installed-setuid-root/194856
$ type sudo
sudo is hashed (/usr/bin/sudo)
$ ls -@@eil /usr/bin/sudo
-r-s--x--x 1 501 wheel 168448 Dec 2 2015 /usr/bin/sudo
$ md5 /usr/bin/sudo
MD5 (/usr/bin/sudo) = 7d986f7707c0f11264554cd4354ef80d
I then
$ /usr/bin/sudo mv /usr/local/bin/sudo /usr/local/bin/sudo-strange
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
I find a truly depressing answer here: https://askubuntu.com/questions/452860/usr-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set . But I'm an optimist so I ignore the first answer and do what the second answer tells me to:
$ chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
chown: root: illegal group name
which tells root doesn't exist. But when I
$ whoami
root
So I'm at a dead end and I really don't want to take two days reinstalling EVERYTHING.
Any suggestions?