Fixing broken perl5 / perl5.8 macports installation

So after spending an entire weekend rebuilding my Macbook last month, with a nice shiny new Macports installation that successfully upgraded the installed ports on the first two times I ran sudo port upgraded outdated, I was somewhat dismayed when the third attempt failed dismally:

--->  Installing perl5 @5.12.3_0+perl5_12
--->  Deactivating perl5 @5.8.9_0
--->  Cleaning perl5
--->  Activating perl5 @5.12.3_0+perl5_12
Error: Target org.macports.activate returned: Image error: /opt/local/bin/a2p is being used by the active perl5.8 port.  Please deactivate this port first, or use 'port -f activate perl5' to force the activation.
Portfile changed since last build; discarding previous state.
--->  Computing dependencies for apache2
--->  Dependencies to be installed: perl5
--->  Activating perl5 @5.12.3_0+perl5_12
Error: Target org.macports.activate returned: Image error: /opt/local/bin/a2p is being used by the active perl5.8 port.  Please deactivate this port first, or use 'port -f activate perl5' to force the activation.
Error: Failed to install perl5
Log for perl5 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_perl5/main.log
Error: The following dependencies were not installed: perl5
Error: Unable to upgrade port: 1
To report a bug, see <http://guide.macports.org/#project.tickets>

After wasting valuable minutes of my life reading this thread, I managed to figure out a nice, clean fix.

Firstly, use this command to see which versions of perl5 you have on your system:

sudo port installed | grep perl

In my case the output looked like this:

  perl5 @5.8.9_0
  perl5 @5.12.3_0+perl5_12
  perl5.12 @5.12.3_1 (active)
  perl5.8 @5.8.9_3 (active)

So I used these two commands to remove perl5.8 from my system:

sudo port uninstall perl5 @5.8.9_0
sudo port uninstall perl5.8

I then reissued the sudo port upgrade outdated command and, upon doing so, tons of things recompiled (mostly stuff that was dependent on p5). The process took a while but completed successfully and, most importantly, GIMP worked fine afterwards. :-)

photo

What a hint, saved my

What a hint, saved my time....

Thanks

photo

fixing broken perl5 macports install

Just great!

Solved my problem with this annoying msg when preparing to install OpenCV.

Good job and congrats!

photo

thanks!

Thanks. This fixed my identical issue.

photo

The general idea?

So is the general idea to remove the packages for the OLDER version and then let the newer version update cleanly? My version numbers were slightly different, but I removed the two packages associated with perl5.8/perl @5.8.x and kept the ones that were more current, the perl5.12/perl @5.12.x.

Thanks for this.

photo

Not sure...

I'm not sure about that error.

To be honest, I have decided to wean myself off Macports by using Zend Server (CE) for PHP/Apache/MySQL and installing other apps (such as GIMP) from the installer packages provided by the authors or simply compile from source (eg. ffmpeg and friends). The reason for this is that I want to upgrade to Lion, but I'm pretty sure, based on several blog posts, that Macports is going to die yet again and require more time to clean up than the actual Lion installation is going to take. As a professional software developer I just cannot afford to be spending hours and hours fiddling around with Macports every time I upgrade OS X.

photo

Hi, i get a similar output,

Hi,

i get a similar output, but when i try to sudo port uninstall perl5 @5.8.9_0
---> Uninstalling perl5 @5.8.9_0
Error: port uninstall failed: error deleting "/opt/local/var/macports/software/perl5/5.8.9_0": directory not empty

I guess deleting the port manually is not a good idea, any alternatives?

N

photo

Thank god for you

I have been googling this for what feels like forever. Thank you.

photo

Thanks!

Just did a fresh install and update, then installed directly from the web and then I ran into this bug... Why its not posted on macports I have no idea,

This work 100% thx! E10^6

photo

Thanks!

Thanks for posting this, it worked perfect.

photo

Thanks for this.

I haven't updated macports in a long time and encountered the same thing. This saved me some time.

photo

I ran into the same problem

I ran into the same problem but your suggestion worked perfectly. Thanks!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
By submitting this form, you accept the Mollom privacy policy.