Solution to invalid gem format

# hrisff on 24 Jun 06:02:

Anyone else getting this?

$ sudo gem install rails ERROR: Error installing rails: invalid gem format for /usr/local/lib/ruby/gems/1.8/cache/activesupport-2.1.0.gem

2.0.2 is installed and working. Using gem v1.2.0 on Leopard

deleting the cached gem and retrying doesn’t help. # pentor on 24 Jun 14:45:

Same problem here as chrisff also today… could it be a bug in that file or in the repository? # Vincenzo Acinapura on 24 Jun 15:08:

Same problem here, I’ve installed rubygems 1.2.0 and ruby 1.8.7-p22. When I try to install rails, I get “invalid gem format for /usr/local/ lib/ruby/gems/1.8/cache/activesupport-2.1.0.gem” # JoeTheIntern on 24 Jun 16:12:

Exact problem as chris, pentor and Vince – it was driving me crazy. Deleting the cache did not help – the gem magically reappears each time.

I managed to install ActiveSupport 2.1.0 by downloading from its rubyforge project page manually and installing locally, and then “gem install rails” goes through just fine. Looks like a bad repository version to me.

Was upgrading from Rails 1.2.3 on Vista, using RubyGems 1.2. # TomH on 24 Jun 19:21:

I used @JoeTheIntern’s instructions and was able to resolve the problem.

Download gem to a local file, then

sudo gem install—local activesupport-2.1.0.gem

All fixed.

Thanks Joe!

I found that the problem was using as one of the source repositories. once i removed it, and cleaned out the cache directory, things worked fine.