Sie sind auf Seite 1von 2

HOWTO: installing, updating and removing rubygems

Categories:
Rubygems
Installation and Setup

Contents
1 Aim
2 Searching
3 Installing
4 Outdated
5 Updating
6 Clean
7 Removing
8 Listing installed gems

Aim
To give an overview of installing gems, updating them and, if necessary, removing them. We'll also look at some
housekeeping and clean up and remove older versions of updated gems.

Searching
Installing a gem in fair enough but what if you don't know what it's called?
Well, one way of finding a gem is to look at the rubygems homepage at http://rubyforge.org/projects/rubygems/
However, this can be a bit overwhelming and may be a long way around if you know what you are looking for. In
cases like these you can search a remote list of gems for the phrase you are after:
gem search mysql --remote gems.rubyforge.org

This will give a list of gems with the word 'mysql' in them.

Installing
Installing a particular gem is very simple:
sudo gem install mysql

That will, not unsurprisingly, install the gem 'mysql' (which is the ruby bindings for MySQL, not MySQL itself!).
The example above will give a choice of versions to install. On a Linux VPS simply choose the latest 'ruby' version. So
at the time of writing I would select option (3) mysql 2.7 (ruby).
Often a gem will have several dependencies with it. To stop the install asking if you want the dependencies to be
installed use this:
1 of 2

sudo gem install mysql --include-dependencies

Outdated
To get a list of gems that are now outdated (they have a newer version available), use this command:
gem outdated

Updating
To update all the installed rubygems is just as straightforward:
gem update

However, you may not want to update all at once, in which case specify the gem:
gem update mysql

Clean
This will remove outdated versions of gems that are installed, leaving the new updated version installed:
gem clean

This will leave a nice and shiny up to date rubygems install.

Removing
At some point you may want to get rid of a gem completely. No problem:
sudo gem uninstall mysql

Listing installed gems


To get a list of locally installed gems, issue this command:
gem list

That will give an overview of the gems you have installed.


Retrieved from "http://wiki.vpslink.com/index.php?title=HOWTO:_installing,_updating_and_removing_rubygems&
oldid=15283"

2 of 2

Das könnte Ihnen auch gefallen