sudo: command not found on MacOS Sierra

Whenever I try to install something using sudo I get this error -bash: sudo: command not foundIf I do echo $PATH it returns /opt/local/bin:/opt/local/sbin:’/usr/local/bin:??I haven't been able to find any solutions online.

10

1 Answer

As a temporary solution, run this command:

export PATH=/usr/bin:/usr/sbin:/bin:/usr/local/bin:/sbin:/opt/x11/bin:$PATH

Then do sudo vi .bash_profile and place /usr/bin at the end of what's already there. Press I in order to begin editing the document, Esc to stop, and type :x to save and quit the editor.

However, you aren't able to use apt-get or yum on a macOS system. The closest macOS has is Homebrew or Macports.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like