Ruby Gem Tips


The following tips are the result of searching for solutions for problems encountered during work. So these tips are tested solutions discussed in the online forum and blogs.


How to Downgrade Rubygems using rvm.

$ rvm rubygems 1.8.10

This command will downgrade rubygems to 1.8.10.

Downgrading System Wide Installed Rubygems

gem update --system x.y.z.gem 


Install a Specific Version of Gems

To install a specific version of gems from a list of gems in a file:

cat gems.txt | while read x; do rvm use @@global && gem install $x -v=2.3.8 ; done

This command installs the gems with version 2.3.8 in the global rvm gemset.

How to Install Local Gem

Step 1

Download the .gem file.

Step 2

gem unpack gem-name.gem .

where . is the current directory

Step 3

Specify in Gemfile:

   gem 'name-of-gem', '0.1.0', :path => "/path/to/the/unpacked/gem/directory"

Step 4

bundle install

Uninstall a List of Gems

To install a list of gems from a given gems.txt file:

cat gems.txt | while read x; do rvm use @@global && gem uninstall $x -a; done

Uninstall all Gems

gem install bundler -v 1.1.2
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
rvm use @global && gem uninstall

Turn Off ssl-verify When Accessing Private Gem Repo

Create a file .gemrc in your login directory. Its contents should be:

:ssl_verify_mode: 0

Suppressing Deprecation Warnings:


Gem::Deprecate.skip = true

to preinitializer.rb in a Rails project.

Related Articles

Software Compatibility Best Practices

I spoke to some of the most talented and experienced software developers. I have created a guide that is filled with valuable insights and actionable ideas to boost developer productivity.

You will gain a better understanding of what's working well for other developers and how they address the software compatibility problems.

Get the Guide Now