New port config could make MacPorts' setup much easier

Rainer Müller raimue at macports.org
Fri Feb 8 16:25:47 PST 2008


Hi,

I am thinking about a new port config target, which could make setting
up MacPorts much easier. Currently, the appropriate variables for PATH,
MANPATH and DISPLAY are determined in the postflight script. If we would
move that into a port config target (or port setup, the name is open for
discussion), the manual setup process would become easier.

To get the env vars needed for your system, you would type:
   port config --envvars
which would output:
   export PATH=/opt/local/bin:/opt/local/sbin:$PATH
   export MANPATH=/opt/local/share/man:$MANPATH

But to support multiple shells, this could be extended to also allow
   port config --envvars --tcsh
which would output:
   setenv PATH /opt/local/bin:/opt/local/sbin/:$PATH
   setenv MANPATH /opt/local/share/man:$MANPATH

So the default should be auto-guessing which shell to use (current 
$SHELL). There could be support for a lot of shells people are using.

The env vars which would be exported will be depending on the system 
this runs on, e.g.:
Leopard:       PATH and MANPATH
Tiger/Panther: PATH, MANPATH and DISPLAY

Another switch, port config --profile could output the profile file of
the current running shell. This would be .tcshrc for tcsh, .bash_profile 
for bash, .zshrc for zsh and maybe others, too.

So after all setting up MacPorts could become just this line:
   /opt/local/bin/port config --envvars >> \
                                $(/opt/local/bin/port config --profile)

Or a command /opt/local/port config --setup could do it all automatically.

The main purpose would be that we are moving this away from the dmg 
installer and into base itself. So even if the installer postflight 
script fails in future again, there would be an easy option to setup 
MacPorts. Additionally this could also be useful for users installing 
from source.

As the postflight script is broken in the 1.6.0 dmg, we have seen a lot 
of people on IRC and the users mailing list looking for help how to get 
MacPorts running. Telling them "set up your PATH manually" sounds too 
complicated for some users and they might quit using MacPorts at all.

What do you think about such an option?

Rainer


More information about the macports-dev mailing list