0

Whenever I try to install something using sudo I get this error -bash: sudo: command not found If 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.

  • Sierra's sudo is located in /usr/bin; that seems to be missing from your path. – lungj Aug 16 '17 at 18:52
  • Did you modify your shell profile to override the path? Or did you even modify some system files? (What are you trying to install with sudo?) – slhck Aug 16 '17 at 19:01
  • Seriously? Your PATH is /opt/local/bin:/opt/local/sbin:’/usr/local/bin:?? ? Can you run anything ? – Scott Aug 16 '17 at 19:22
  • @lungj how do I put it into the path? – Tyler Bloom Aug 16 '17 at 19:35
  • @slhck How do I modify the shell profile? – Tyler Bloom Aug 16 '17 at 19:35
2

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.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.