Fixing Missing Gem Problems on OS X

Posted on . Tagged with: .

Disclaimer: This could potentially bugger up Ruby and Ruby Gems on your machine, proceed carefully.

Recently I’ve been doing quite a few REST API building stuffs with Ruby, Sinatra and trying to pick up ActiveRecord to use with Rails. I was however getting quite a lot of problems with Gems loading, but not loading completely.

If when running gem check --alien, you get something similar to below:

rails-1.2.6 has 2 problems
	Spec file doesn't exist for installed gem

	missing gem file /Library/Ruby/Gems/1.8/cache/rails-1.2.6.gem

Clear out all of the gems located in the following directories. You will need to similarly remove anything in the bin/, cache/, doc/, gems/ and specifications/ directories.


(These directories can be found by entering gem environment).

You will then need to reinstall all of your gems. You may wish to issue a gem check on each of them to ensure it’s all good.