Mac – “sudo: port: command not found” after installing MacPorts on Snow leopard

macmacportsosx-snow-leopardpath

I have attempted to install MacPorts in order to upgrade my Rails version so that I can work my way through Agile Web Development with Rails, PragProg (4th, 2011). I have followed the directions in the book, as well as on the MacPorts web site, to perform the install from disk image. It appeared to install correctly, however, running port commands afterwards returned "port: command not found".

I searched Stack Exchange and found this question, so I attempted to install from the command line using "tar xjvf MacPorts-1.9.2.tar.bz2". Again, the install seems to work. I receive the confirmation that MacPorts installed successfully, but I still receive "sudo: port: command not found" error on trying to selfupdate MacPorts (via "sudo port -v selfupdate").

I think that my error lies in not having the correct path set. I followed the advice in this thread, namely, adding a path (/opt/local) in paths.d, but I still get the error.

If it matters, terminal is set to open shells with default login shell (/usr/bin/login). Should I change this to /bin/bash?

So, is this a MacPorts issue, a $PATH issue, or a StupidUser issue?

Best Answer

It is probably a PATH issue.

By default port is installed the directory /opt/local/bin. Add the path 'opt/local/bin' as an extra line to the plain text file /etc/paths and you should be good.

Related Question