Search code examples
macosbashsudo

-bash: sudo: command not found Mac OS X (EC2 CLI prob?)


Getting the error:
-bash: sudo: command not found
echo $PATH outputs PATH:EC2_HOME/bin
I'm running Mac OSX 10.8.3

That seems wrong even for a n00b like me. How do I fix my $PATH and return my computer to it's former self?


Solution

  • As stated in the comments the right files to set up your $PATH variable are: ~/.profile or ~/.bash_profile

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

    In this way when you re-enter in the console your PATH will work fine. You can add other directories to your $PATH as you like.

    If you just copy and past that line in an active console you just set the PATH variable temporary, when you logout and login again you will loose your path, so add it in your ~/.bashrc file.