sudo "Command not found"

Discussion in 'Mac Programming' started by Spontida, Nov 9, 2013.

  1. Spontida, Nov 9, 2013
    Last edited: Nov 9, 2013

    Spontida macrumors regular

    Joined:
    Aug 7, 2011
    #1
  2. chrfr macrumors 603

    Joined:
    Jul 11, 2009
    #2
    What's the output of
    Code:
    which sudo
    Most likely the error you're seeing is that whatever you're typing after sudo is what's not found.
     
  3. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #3
    The site your linking to is about installing wine through MacPorts. It should be :

    Code:
    sudo port install wine
    not :

    Code:
    sudo install wine
    .

    Please post the exact commands or lines you pasted in Terminal and the exact output or errors you got of those commands. Or make a screenshot of your Terminal window.
     
  4. kage207 macrumors 6502a

    Joined:
    Jul 23, 2008
    #4
    Uh, are you on the admin account? Cause every Unix machine has the ability to sudo, it means to run as admin, even if you aren't on the admin user account.
     
  5. Spontida thread starter macrumors regular

    Joined:
    Aug 7, 2011
    #5

    From
    Code:
     which sudo 
    I get

    Code:
     command not found 
     
  6. kryten2, Nov 9, 2013
    Last edited: Nov 9, 2013

    kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #6
    Your PATH is messed up. It should be something like this before you started :

    Code:
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    After running this :

    Code:
    echo export PATH=/opt/local/bin:/opt/local/sbin:\$PATH$'\n'export MANPATH=/opt/local/man:\$MANPATH | sudo tee -a /etc/profile
    it would be :

    Code:
    /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    Close your Terminal window. Open a new Terminal window and type :

    Code:
    echo $PATH
    cat /etc/profile
    Post the output you get from those lines. sudo can be found in the /usr/bin directory. If you navigate to that folder in the Finder you can check if it is there.
     
  7. Spontida thread starter macrumors regular

    Joined:
    Aug 7, 2011
    #7
    I got no output but sudo is indeed there.

    If I type in $PATH again, the output is this still:

    Code:
    -bash: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:: No such file or directory
    I also still get:
    Code:
    -bash: sudo: command not found
    When typing
    Code:
    which sudo
     
  8. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
  9. tominco macrumors member

    Joined:
    Mar 14, 2008
    #9
    Simply try

    /usr/bin/sudo <whatever_command_follows>

    then be prepared to enter your password to continue.

    But beware. Any commands you issue preceded by sudo will be run as "root" (aka administrator) on your computer and you are at risk of screwing things up rather nicely if you don't know what you're doing with the Unix command line.
     
  10. aarond12 macrumors 65816

    aarond12

    Joined:
    May 20, 2002
    Location:
    Dallas, TX USA
    #10
    Both the "which sudo" and "whereis sudo" commands should give you "/usr/bin/sudo". If you're getting "command not found" on "which", then your computer has some serious problems.

    Have you tried: sudo -s
     

Share This Page