Setting up multiple MacPorts copies on one machine

Bryan Blackburn blb at macports.org
Wed Apr 22 01:31:08 PDT 2009


On Wed, Apr 22, 2009 at 09:11:58AM +0200, Rainer Müller said:
> David Bruce wrote:
> > My question is how people make this simple to manage.   Is there an
> > established way to set up aliases, paths, etc? I want to be sure that
> > if I type "sudo port", I run the default macports copy, and have a
> > function or alias (say "sudo tuxport") that gives me "port" from my
> > non-default installation.
> 
> To be really sure, just use the full path to the port binary. Otherwise
> a alias should do fine, but note that shell aliases will not work with
> sudo. You would have to create a symlink.

What I do is use aliases for those installs which are owned by me, and
basically work like:


basepath="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
alias port-1.7="/usr/bin/env PATH=/Users/blb/MacPorts/mp-1.7/bin:${basepath} port"
alias port-test="/usr/bin/env PATH=/Users/blb/MacPorts/mp-test/bin:${basepath} port"
...
unset basepath


This way PATH does not even know about any other installs; note that by
default my PATH has the location of my primary install which is root-owned.

For those which are root-owned, I use a shell script wrapper around the
alias idea, and adding $*.

Using the actual software installed by port into these various alternate
locations is left as an exercise.

Bryan


> 
> Rainer


More information about the macports-dev mailing list