Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal doesn't understand sudo command

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?

Macbook Pro, Mac OS X (10.5.6)

Posted on Dec 27, 2008 7:14 PM

Reply
9 replies

Dec 27, 2008 8:55 PM in response to Kappy

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"

Dec 27, 2008 8:56 PM in response to Kappy

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

Terminal doesn't understand sudo command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.