Fix: sudo: port: command not found


I’m trying to setup Python 2.7 and SciPy and hit a major roadblock. I kept getting
sudo: port: command not found

On Mac OSX, I’m on Yosemite, if you’ve installed MacPorts with the package installer and have the same issues that I encountered I’ve got the fix. Part of the problem is that MacPorts binaries are installed in /opt/local/bin, so you just need to add this path to your PATH environment variable. Example with your user, add to your $HOME/.profile:

Add the following in terminal —

Step one:

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

Step two:

$ source .profile

Step three:

sudo port -v selfupdate


  1. Hello, I did try to follow the above procedure but unfortunately I still get the error “sudo: port: command not found”.

    Can you please guide me?


Please enter your comment!
Please enter your name here