what to do, if you locked yourself out from Mac OS?

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:

/sbin/fsck -fy 

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.

echo $PATH 

It should contain /usr/bin near the beginning.

3 Replies to “what to do, if you locked yourself out from Mac OS?”

  1. durch ein Update von mysql und/oder jRuby + gems und Ruby + gems…

    Und durch eine zu späte Uhrzeit 😀

Leave a Reply