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

Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.