Reputation: 13062
I have installed MacPorts in my MacBook Pro with Snow Leopard. I hadn't explicitly installed perl there but I guess it either came installed with the default macports install or was installed as a dependency by any other port I installed.
I want to upgrade the Perl v5.8.9 there with the latest stable Perl version. Whichever it may be currently (I see it is 5.12.2). So, my question is simply how do I do a complete replacement of the old Perl with the new in macports.
Will sudo port upgrade perl5
work or do I need to do something else as well. I just wanted to make sure this was the right command so as to avoid screwing up my macports install.
Upvotes: 4
Views: 8019
Reputation: 8759
I did this when moving from Perl 5.26 to 5.28:
$ sudo vi /opt/local/etc/macports/variants.conf
to add +perl5_28
(using emacs is allowed :-)$ port depend perl5.26 | awk '!/p5.26/ { print $1 }' | xargs sudo port install
to upgrade perl, git and the like to sit on top of the new variant$ sudo port uninstall --follow-dependents perl5.26
to eliminate Perl 5.26.Upvotes: 1
Reputation: 74
You'll need to uninstall perl5.8
before installing perl5.12
:
sudo port deactivate perl5.8
sudo port uninstall perl5.8
sudo port install perl5 +perl5_12
Note: If uninstalling perl5.8
fails, you might force the uninstall by
sudo port uninstall -f perl5.8
WARNING: This might break other packages' dependencies.
But so far, it did the job for perl
(and for me):
% perl -v
This is perl 5, version 12, subversion 2 (v5.12.2) built for darwin-multi-2level
Upvotes: 4
Reputation: 47183
port upgrade packagename
is the right form, yes.
But i think that in this case, it's a bit trickier than that.
Have a look at the perl5 portfile. It's a wrapper which simply depends on perl 5.8. If you just sudo port upgrade perl5
, it won't get you to 5.12. However, the perl5 package has a couple of variants for 5.10 and 5.12. You should be able to see all this locally with port variants perl5
.
What i'm not sure about is whether you can pass variant flags (+perl5_12
in this case) to port upgrade
, or whether you need to do a new port install
on top of your current installation. Or even, horror of horrors, uninstall the current package before installing the variant.
The whole variant mechanism was a mistake, IMHO. An interesting and worthwhile experiment, but one from which we've learned it was a bad idea.
EDIT: i think you can add a variant to an installed port; it seems you have to say:
sudo port deactivate perl5
sudo port install perl5 +perl5_12
Upvotes: 6