Yesterday I found myself in a strange situation:
Every Shell Command I tried to use ended up with a “command not found“. This happened with sudo, nano … you name it.
After a short time, I figured out that the folder /usr/bin (where all these programs are stored) had only executable rights for the owner (so admin:wheel).
As a normal user I was not able to use them.
So how to change this if you cannot sudo ?
As always in MacOS, the best way to fix this, is to boot into Singe User Mode (restart and press the Apple/Command Key + “S”).
After you got into the Terminal view you have to scan the filesystem for errors:
And then remount it as writable:
/sbin/mount -wu /
Now, you can alter the user rights for /usr/bin with:
chmod 755 /usr/bin
After a reboot you are again able to execute the commands.
If you still have problems you should control your PATH-settings.
It should contain /usr/bin near the beginning.