How do I replace system perl with MacPorts perl?

Erik Norgaard norgaard at locolomo.org
Sat Jul 26 08:40:36 PDT 2008


Daniel J. Luke wrote:
> On Jul 26, 2008, at 10:50 AM, Erik Norgaard wrote:
>> This ought to be straight forward - well, maybe it is:
>>
>> I have installed macports and perl5.8 into /usr/local/bin,
> 
> We recommend that you do not set your macports ${prefix} to /usr/local  
> as it can result in some strangeness.

OK, I thought that was a problem with darwinports that had been 
resolved. I come from FreeBSD and like to have the same paths to my 
binaries.

I found no information on the current site that this is a bad idea - in 
fact, the ${prefix} variable is the only one mentioned for those who 
compile macports from source.

>> while the
>> system perl remains in /usr/bin - most manuals and scripts expect to
>> find perl in /usr/bin so they continue to use the system perl, and
>> further this has different @INC so the modules installed with macports
>> are not found.
> 
> Right, the macports perl is separate from the system perl.
> 
>> What is the recommended way of replacing the system perl (leopard)  
>> with
>> the perl of macports?
> 
> You don't want to do that (for one thing, Apple's next softwareupdate  
> may upgrade the system perl and overwrite whatever changes you make).
> 
> One thing you can do is change your $PATH so that just typing 'perl'  
> at the command prompt runs the macports perl. You can change the #!  
> line in your perl scripts to either call the macports perl or to look  
> up perl in the environment (#! env perl)

This is problematic. Tons of scripts, my own and third party, and all 
documentation refers to the /usr/bin/perl path. The subject has been 
discussed thoroughly on the FreeBSD lists for that very reason.

The generally accepted solution AFAIK is to install perl binary as say 
/usr/local/bin/perl5.8.8 and link to it...

BR, Erik

-- 
Erik Nørgaard
Ph: +34.666334818/+34.915211157                  http://www.locolomo.org


More information about the macports-users mailing list