Clone MacPorts and Switch between clones

Ryan Schmidt ryandesign at
Sat May 8 14:17:09 PDT 2010

On May 8, 2010, at 15:21, Marko Käning wrote:

> I'd like to experiment with kdelibs4, but don't want to give up my current MacPorts installation which is running kdelibs3, which is colliding with the newer lib of course.
> I hope there is a way to have more than one MacPorts system installed on one machine which could be ideally cloned from an existing one. Also I imagine there must be an easy way to switch between these independently run versions of MacPorts.

Yes, you can run multiple MacPorts prefixes on a machine. The way to do so is to compile MacPorts from source and give it the --prefix=/wherever configure argument, where /wherever is where you want this new MacPorts to be. You'll also want to give it a different --with-tclpackage, --with-frameworks-dir and --with-applications-dir so as not to collide with the ones from your primary MacPorts prefix. Enabling readline is probably a good idea too. So you might use:

./configure \
--prefix=/wherever \
--with-tclpackage=/wherever/Library/Tcl \
--with-frameworks-dir=/wherever/Library/Frameworks \
--with-applications-dir=/wherever/Applications \

You won't be able to clone or copy anything from your existing MacPorts prefix to this new one, because things installed with MacProts have their prefix hardcoded into them; you have to rebuild everything in the new prefix.

Alternately, if you can stand to disable your kde3 stuff while playing with kde4, you can do it all in one prefix. Just "sudo port deactivate" the kde3 parts and then "sudo port activate" all the kde4 parts. And vice versa when you want to switch back.

More information about the macports-users mailing list