Last Updated: February 25, 2016
· destructuring

Building MacPorts without root, anywhere

I like to vendor MacPorts to support applications, like a MacPorts distribution for xmonad, and another for my Ruby development. This means anchoring to a directory and never using root.

Build the "ports" utility with these options to anchor in "$HOME/xmonad"

./configure --prefix "$HOME/xmonad" --with-install-user=$(id -u -n) --with-install-group=$(id -g -n) --with-no-root-privileges

In "variants.conf", specify global variants:

+no_root -startupitem

In "macports.conf", also set startup item options:

startupitem_type none
startupitem_install no

Also, change paths to include prefix "$HOME/xmonad".

Some ports will hardcode root options and assume chgrp will succeed -- nothing a "port edit" won't fix.

Say Thanks