views:

46

answers:

3

I'm running Mac OSX 10.6.4 and have installed RVM. Its been great so far, I really love the way it lets me manage having multiple versions of rails and ruby on the same machine without headaches!

However, I don't want to have to install certain gems (such as passenger) for each setup. Is there a way to share gems between gemsets? I have a [email protected] and 1.9.2@rails3, can I have gems such as passenger, mysql, and capistrano installed once and used with all versions?

+1  A: 

You can create and use global gemsets with the following commands:

rvm gemset create global
rvm gemset use global

After you've created and execute use for the global gemset simply install gems as usual:

gem install mysql, passenger
ennuikiller
A: 

add the the gems you want for every gemset in a "global" rvm gemset name i.e.

rvm 1.9.2@global

then project specific gemsets rvm 1.9.2@myProject will already have you're "default" gems from your global list

Justin Soliz
A: 

There is something called the global gemset, and it is shared between all your gemsets of a certain ruby-version. But you can't share gems between ruby-versions.

However, what you can do is create a list of gems that will be installed automatically when adding a new ruby version. That is described here. In short: edit a file called ~/.rvm/gemsets/global.gems to contain the list of gems you want to be there for each ruby-version.

Hope it helps.

nathanvda
thanks, you're the only one who actually answered the question. We can't share the gemsets between ruby interpreter versions (ie 1.8.7 and 1.9.2) but the global gemset can be used to share between projects of the same ruby version (ie, gems installed globally for 1.8.7 will be shared among projects using this version). Also, I up-voted ennuikiller's answer because he actually gave the commands for creating the global gemset.
GiH