[ACCEPTED]-How do I use RVM and create globally available gems?-rubygems

Accepted answer
Score: 70

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

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

Hope it helps.

Score: 62

With the latest RVM version (1.17.0 and 2 newer) just type:

rvm @global do gem install passenger


rvm 1.9.3@global do gem install passenger if you need it only 1 for a specific version of ruby.

Score: 32

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

rvm gemset create global
rvm gemset use global

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

gem install mysql passenger
Score: 4

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

rvm 1.9.2@global

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

Score: 3

Create and use a global gem as:

rvm use <ruby version>@global --create

and install 3 gems you want to share between gemsets:

bundle install <gem name>

but 2 these gems can only be shared between gemsets 1 of the same Ruby version.

Score: 2

According to the RVM documentation, there 6 are actually a number of "global" gemsets 5 which can be defined at the rvm-wide level, per 4 interpreter, per interpreter version, and 3 finally at a specific patch-level per interpreter. And 2 installed gems cascade from one level to 1 the next.

Score: 1

If you need to install a particular gem 1 across multiple rubies you can do:

rvm all do rvm @global do gem install passenger

Score: 0

For someone wanna manually trigger install 1 rvm global.gems

rvm gemset import ~/.rvm/gemsets/global.gems

# or

cat ~/.rvm/gemsets/global.gems | xargs gem install

More Related questions