Darwin Ports Gotcha! Removing a Version of a port


So a couple of days ago i wanted to put mongrel on my laptop, it’s elsewhere, but i needed it on my laptop. Mongrel requires ruby 1.8.4 or better… I was running, with darwin ports, ruby 1.8.2. I did the normal sudo port upgrade ruby. But for some reason, probably because i closed my laptop and changed it’s net connection, it died. I thought, no problem, it’ll be easy to redo, nope. It wouldn’t let me install it because it said it was already partially installed….

rabble:/opt/local/bin evan$ sudo port install ruby
-> Activating ruby 1.8.4_2
Error: Target com.apple.activate returned: Image error: Another version of ruby (1.8.2_4) is already active.
Error: /opt/local/bin/port: Status 1 encountered during processing.

When i tried to uninstall ruby i got even more stuck.

rabble:/opt/local/bin evan$ sudo port uninstall ruby
-> The following versons of ruby are currently installed:
-> ruby 1.8.2_4 (active)
-> ruby 1.8.4_2
Error: /opt/local/bin/port: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.

I couldn’t uninstall nor could i upgrade. I searched through the darwin ports docs and nowhere is it written how to specify the version you are dealing with. I asked in irc and nobody in the #darwinports at the time came up with an answer. Eventually i came across the way darwin ports specifies versions of ports. They use an @ sign. Who would have thunk.

Uninstalling a specific version of a darwin port

rabble:/opt/local/bin evan$ sudo port uninstall ruby @1.8.4_2

The trick is that darwin ports specifies versions with an @ sign, i assume this is a bsdism… which the darwin ports kids didn’t even think of documenting because it’s so basic. Well know i know. And hopefully this blog post will help others in search of the same issue.


3 Comments, Comment or Ping

  1. You know, I struggled with just this issue last week. Thanks for writing it up.

    For the record, you might have been able to deal with the original problem by:

    sudo port deactivate ruby<br />
    sudo port install ruby


    DP must have gotten bogged down in the install process after having gotten everything ready for installation, but before having deactivated the old version of Ruby. Then, when you asked it to install Ruby, it just jumped straight to activation, skipping the crucial deactivation step.

    You could also have tried:

    sudo port clean ruby<br />
    sudo port install ruby


    That would have (hopefully) cleaned up the mess left by the aborted installation, then installed Ruby anew.

    May 22nd, 2006

  2. kellan

    It ain’t a BSDism, the whole “port install” thingy that works kind of like apt is a Darwin Ports-ism.

    Which was a total shock for me when I found myself on a FreeBSD box. I had just assumed the knowledge was transferable.

    May 22nd, 2006

  3. rabble

    Clean doesn’t work if you have multiple versions, same problem. i tried that as well. Well now it’s documented and discoverable via google.

    May 22nd, 2006

Reply to “Darwin Ports Gotcha! Removing a Version of a port”