MacPorts vs Mac PATH Conflicts - Best Workaround???

Harald Hanche-Olsen hanche at math.ntnu.no
Sat Nov 13 17:13:45 PST 2010


+ LeAnne Lis <lisfolks.lists at gmail.com>:

> I understand that MacPorts exports /opt/local/bin and
> /opt/local/sbin in the .profile to ensure its paths go to the front
> of the env PATH.  Apparently this is done because typically Apple
> has older versions of "stuff" than MacPorts, and, of course, most
> MacPorts users want to use the new stuff.
> 
> What if, however, there is an instance (or two) where a user wants
> the Apple version to be accessed rather than the MacPorts version?

Create a new bin directory and put it in front of everything else in
PATH, then if you want to use (say) /usr/bin/ssh rather than
/opt/local/bin/ssh, put a symlink to the former in the new bin
directory.

I like to have a directory /local/bin that will apply for all users on
the machine: So you do

  ln -s /usr/bin/ssh /local/bin/

To put /local/bin at the front for everybody, do

  echo /local/bin > /etc/paths.d/10-local

For stuff you want to be at the front for only yourself, create a
directory bin in your home directory, add the line

  PATH=$HOME/bin:$PATH

in your .profile, and put symlinks and other useful stuff there.

- Harald


More information about the macports-users mailing list