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.


About this entry