Wednesday, 15 April 2015

Way to clean up gem OR remove old versions to keep the most recent

Way to clean out any old versions of gems.

    > sudo gem cleanup

If you just want to see a list of what would be removed you can use:

    > sudo gem cleanup -d

You can also cleanup just a specific gem by specifying its name:

    > sudo gem cleanup gemname

for remove specific version like 1.1.9 only

   >  gem uninstall gemname --version 1.1.9

If you still facing some exception to install gem, like:

invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/rails/.rvm/gems/[email protected]/cache/nokogiri-1.6.6.2.gem

the, you can remove it from cache:

    > rm /home/rails/.rvm/gems/[email protected]/cache/nokogiri-1.6.6.2.gem

No comments:

Post a comment