Unable to uninstall capistrano even though its listed as installed? Here’s how to fix that
At some point my installation of capistrano here in OSX got corrupted or something. Either way, whenever I would try to run `cap deploy`, on a project that everyone else could deploy just fine, I’d get an error message like this:
Brians-Laptop-2:railsapp brian$ cap deploy
/opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:636:in `report_activate_error': RubyGem version error: capistrano(2.5.5 not = 1.4.2) (Gem::LoadError)
Which was weird for a couple reasons. One, the capistrano gem that was frozen into the rails project was specified to be 2.5.3. Capistrano 2.5.5 (which this was saying I had activated) should have run just fine that way. But then second, where was this 1.4.2 mention coming from? Nothing in the project talked about capistrano 1.4.2.
So, taking a look at my installed gems, it gets even more fun.
Brians-Laptop-2:railsapp brian$ gem list | grep capistrano
capistrano (2.5.5)
Well, lets just uninstall that sucker.
ERROR: While executing gem ... (Gem::InstallError)
Unknown gem capistrano >= 0
Wooo fun. Gem list says I have it, gem uninstall says I don’t. Anyway, finally figured out that at some point capistrano had been installed to my home directory. Something like ~/.gem/ruby/1.8/gems/capistrano/blahblahblah. Thats the one it was somehow using. So, delete/move that .gem directory.
Then if you actually look at the stack trace from the original `cap deploy` command, you’ll also notice something similar:
from /Users/brian/.caprc:1:in `load'
Well I don’t know wtf this .caprc file is doing in my home directory either, but get rid of that too. Finally, there, I was able to `sudo gem install capistrano` and correctly install capistrano ( 2.5.5 ) to its correct location. From that point, cap deploys should work just fine.
Hope this helps anyone else googling around for the same arcane set of keywords I was.
