Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the ports system on FreeBSD. What is the easiest way to upgrade Perl using ports? I currently uninstall all of perl and it's dependencies. I'd think there would be a cool way to upgrade Perl and all it's dependencies. What would that be?

share|improve this question
up vote 7 down vote accepted

see /usr/ports/UPDATING the entry from 20120630 has detailed description how to do it with portmaster or portupgrade

share|improve this answer
I've upgraded multiple Perl minor versions this way and they never worked well. We'll see this time. Thank you. – EhevuTov Jul 7 '12 at 19:24

Here's the .. more manual way to do it.

perl-after-upgrade is supposed to do the trick for most files (excepting binaries like irssi), however, I find it doesn't work so well anymore, so I just do everything by hand.

Before upgrading perl, I would shut down anything that depends on it, since those things are likely to break while the upgrade process is running. For me, that usually means turning off SpamAssassin, which really means I just shut down postfix for the few minutes it takes me.

I would also dump the current list of dependents on perl - pkg info -r perl, just in case you have to fall-back to manually upgrading everything.

First, build and install the version of perl. All of your perl modules will be broken because they're still installed in the old perl directory. Use portmaster or portupgrade to force a rebuild of all perl modules:portmaster p5- does the trick for me.

Then go look for binaries that have dependencies on perl that are broken - I use libchk for this. Just run it and look for binaries that have unresolvable references to Use pkg which to figure out what port installed that binary, if it's not obvious from the name, and then go and rebuild that port using portmaster or portupgrade.

You can probably start bringing back up your perl-based services, like SpamAssassin.

Then I go poke through the /usr/local/lib/perl5 directory, and see if any files are still there that shouldn't be. pkg which again to figure out where they came from, upgrade those ports, repeat until it's empty or every file is unclaimed.

portmaster -r perl- would be the cheap and easy way to do this, but that would probably spend hours rebuilding things that don't actually need to be rebuilt. This way is probably a lot faster, but it is a lot more work and requires a little bit more fiddling.

share|improve this answer
What specific problems are you having with perl-after-upgrade? It still appears to work fine for me... – voretaq7 Jun 17 '13 at 16:15
It doesn't seem to find anything to move anymore. I run it and nothing shows up. Also, it looks like it's not provided in the ports anymore. I'll admit, it's not something I've given much attention. – antiduh Jun 17 '13 at 16:37
I did have that problem on one system upgrade, but I botched the upgrade in a variety of other ways so I thought it was just me. It's possible this actually broke though - it was always a somewhat hackish solution. – voretaq7 Jun 17 '13 at 16:40
Thank you a lot for this walkthrough. More helpful than "use this command that works for me, and lets not talk about the other cases" :) – Florian Heigl Aug 13 '14 at 20:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.