Opened 4 months ago

Closed 4 months ago

Last modified 3 months ago

#69263 closed defect (invalid)

sudo: port command not found--------already update environment

Reported by: DeliaLing Owned by:
Priority: Normal Milestone:
Component: base Version: 2.9.1
Keywords: Cc:
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Hello, I am facing below issue after installed Macports from website, I searched from google that it could be environment variable issue, so I added port in PATH as below, please have a look this issue, thanks.

++++++++++++++++++++++++++++++++++++=
Last login: Thu Feb 1 15:55:26 on ttys000
linzha02@CRP-MAC-NUAMD6N ~ % sudo port install putty
sudo: port: command not found
linzha02@CRP-MAC-NUAMD6N ~ % echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/CyberArk EPM.app/Contents/Helpers:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/linzha02/Library/Android/sdk/emulator:/Users/linzha02/Library/Android/sdk/platform-tools:/Users/linzha02/Library/Android/sdk/tools:/Users/linzha02/Library/Android/sdk/tools/bin:/opt/local/bin/:/opt/local/sbin/
linzha02@CRP-MAC-NUAMD6N ~ % port -v
MacPorts 2.9.1
Entering shell mode... ("help" for help, "quit" to quit)
[Users/linzha02] >

Change History (2)

comment:1 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Component: portsbase
Description: modified (diff)
Resolution: invalid
Status: newclosed

By adding /opt/local/bin to the PATH, you fixed the problem. MacPorts is now working correctly.

port -v means: enter interactive mode verbosely. That's probably not what you want. Press Control-D to exit interactive mode.

If you wanted to see the version of the port command, use port version.

comment:2 Changed 3 months ago by jmroot (Joshua Root)

The issue is that sudo is configured to change the PATH. You can confirm this by running sudo env. Running sudo sudo -V will give you a lot of information about sudo's current configuration on your system. See the documentation for the env_reset and secure_path sudoers options. This may also be helpful: https://unix.stackexchange.com/questions/8646/why-are-path-variables-different-when-running-via-sudo-and-su

Note: See TracTickets for help on using tickets.