Note: This article was originally published in 2014. Some steps, commands, or software versions may have changed. Check the current Linux documentation for the latest information.

In this step-by-step guide, you’ll learn install, update and remove rubygems.

How to: Install, Update and Remove RubyGems

I just had a brief experience installing a (http://rubygems.org “RubyGems”) so I thought I would share a little bit of what I learned about managing RubyGems. Similar to packages (apt-get) you can search through them, install them, remove them, and update them with simple commands. Below is a brief summary designed just to quickly point individuals to the instructions needed to accomplish the management of RubyGems:

  1. Searching (where mysql is the the search term: it will find any gem that contains the word mysql. The address after —remote indicates the online library where the search will be performed)
    1. gem search mysql —remote gems.rubyforge.org
  2. Installing (where mysql is the gem you are installing and —include-dependencies indicates an automatic answer to yes when it asks to install a needed dependency)
    1. sudo gem install mysql
    2. sudo gem install mysql —include-dependencies
  3. Updating (you may update all gems or specify a particular one like mysql)
    1. sudogem update
    2. sudo gem update mysql
  4. Removing (where mysql is the gem you wish to uninstall)
    1. sudo gem uninstal l mysql
  5. Clean / Removes old versions (I still struggle to understand the difference with update)
    1. sudo gem clean
  6. List installed Gems
    1. gem list

(http://img.zemanta.com/zemified_h.png?x-id=19c81c5e-4801-4984-a206-161f6d4d23f9)](http://www.zemanta.com/?px “Enhanced by Zemanta”)

Summary

You’ve successfully learned install, update and remove rubygems. If you run into any issues, double-check the prerequisites and ensure your Linux environment is properly configured.