Benches macOS

9

Terminal doesn't understand sudo command

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I am installing MacPorts 1.7.0 from a .dmg file. Following, I set up the environment variables in the .profile file, and tried to use Terminal to update using the sudo port selfupdate command from Terminal.

This is the result I got:

-bash: sudo: command not found

Why is this, and what can I do?

9 replies

Sign in or join Beachball Help to reply.

  1. 0

    Kappy

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I think the error refers to the command(s) following "sudo." Were you prompted for your password?

    I got the same error, but not because of "sudo."

  2. 0

    ericmeyers

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Be sure there is a


    source .profile

    at the end of your .bash_profile. All the .profile file does is modify your PATH and MANPATH.

    BTW, port is in /opt/local/bin/port

    Eric

  3. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I think the error refers to the command(s) following "sudo." Were you prompted for your password?

    No, that would be:


    sudo fred
    Password:
    sudo: fred: command not found

    But if the command bash is asked to execute is not found you get


    fred
    -bash: fred: command not found

    So I think he is not finding
    sudo.

    That makes me think that
    PATH has been messed up, because
    sudo is in
    /usr/bin/sudo which is always in
    PATH unless it has been messed up. Which makes me think that
    .profile was properly executed, and that is how
    PATH got messed up.

    So I would look very closely at
    .profile and make sure
    PATH is setup correctly. I would expect it to looks something like:


    export PATH="$PATH:/opt/local/bin"

  4. 0

    pdenlinger

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    No, following the sudo command I was not prompted for my administrative password. I was imagining that it should have but it didn't.

    Here is the content of the .profile file:

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

    export MANPATH=/opt/local/share/man:$MANPATH

    When I tried to run the env command (to see if my environment variables had been updated) I got:

    -bash: env: command not found

    TIA

  5. 0

    ericmeyers

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    You've got 2 problems. The first I'm guessing is you've hosed your PATH environment variable somehow. Did you mess with it in your .bash_profile?

    Second, anything in your .profile has no affect unless you source it (source .profile). See my other answer.

    Fix the first problem first.

    Eric

  6. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Your *export PATH* looks reasonable, but to get the errors you are getting PATH must be missing
    /use/bin

    Try the command:


    echo $PATH

    You should see
    /use/bin and
    /bin in the output. These 2 directories are where most of the normal commands are stored.

  7. 0

    ericmeyers

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    BobHarris wrote:

    Your *export PATH* looks reasonable, but to get the errors you are getting PATH must be missing
    /use/bin

    I'm sure you meant
    /usr/bin πŸ™‚

    Eric

  8. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    And I most llikely typed
    /usr/bin but my iPod Touch spelled checked and auto-corrected it to
    /use/bin

    Chrismas gift I'm still getting used to πŸ™‚

    A wife that knows what a husband likes; Priceless! πŸ™‚

  9. 0

    ericmeyers

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Very nice. Santa didn't bring me one 😟

    Eric