Apple - sudo: command not found

Your PATH is hosed!

First check your .bash_profile file with:

/usr/bin/nano ~/.bash_profile

Prepend lines containing something like export PATH="/... " with a # to comment them out. Save the file with ctrlO and exit nano with ctrlX

Then check /etc/paths with: /bin/cat /etc/paths.

It should look like this:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

You can edit the file with /usr/bin/sudo /usr/bin/nano /etc/paths if required.

If everything is fine enter source ~/.bash_profile or close the Terminal window and open a new one.


Now sudo should work again. Then check all #export PATH=... lines in your .bash_profile for potential errors. You may add them to your question to get help here.