How do I replace system perl with MacPorts perl?

Daniel J. Luke dluke at geeklair.net
Sat Jul 26 09:03:46 PDT 2008


On Jul 26, 2008, at 11:40 AM, Erik Norgaard wrote:
> 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.

/usr/local is a 'special' location for the preprocessor and linker

I ran darwinports (I switched to a 'normal' prefix some time before  
the darwinports->MacPorts transition) for a long time with ${prefix}  
set to /usr/local, but it can cause problems, so we don't recommend it.

> 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.

You should be able to set ${prefix} to just about anything and things  
will just work. The only exception is /usr/local where things will  
mostly just work but you could end up with 'strange' problems.

I find it's also nice to be able to have self-built things in their  
'normal' place (/usr/local) while keeping the macports stuff separate.

>> 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.

if only there were a scripting language that was good at finding and  
replacing strings of text.

> 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...


perl has been through a big transition before (perl4->perl5) where the  
system supplied perl may not have been the one you wanted to use, so  
it's surprising to me that you haven't seen more reference to changing  
the #! or $PATH to select the appropriate interpreter.

No one is going to stop you from overwriting the apple-supplied perl  
in /usr/bin/, but you could be breaking things (ie. any installer  
packages that have a postflight script written in perl that expect the  
apple-supplied perl), and you will break yourself on OS updates (since  
they will feel free to overwrite things in /usr/bin).

--
Daniel J. Luke
+========================================================+
| *---------------- dluke at geeklair.net ----------------* |
| *-------------- http://www.geeklair.net -------------* |
+========================================================+
|   Opinions expressed are mine and do not necessarily   |
|          reflect the opinions of my employer.          |
+========================================================+



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://lists.macosforge.org/pipermail/macports-users/attachments/20080726/c7548ecc/attachment.bin 


More information about the macports-users mailing list