bchruby

List gemsets for a given Ruby version

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Approach A: Bitnami installations using system packages

Bitnami installations using system packages don’t include RVM, but rbenv. Refer to this guide for usage instructions.

Approach B: Self-contained Bitnami installations

RVM allows you to define multiple groups of gems (gemsets) for your RVM-managed Rubies. This is specially useful in those applications not managed using Bundler.

Select an installed Ruby using:

$ rvm use 1.9.3

Then, get the list of defined gemsets by executing:

$ rvm gemset list

gemsets for ruby-1.9.3-p194 (found in /opt/rubystack-3.2.3-0/rvm/gems/ruby-1.9.3-p194)
  global
  project-sample

In this example, two gemsets are available, global (the default gemset with the gems that are available to all other gemsets) and project-sample, a custom gemset created for a sample project.

Create a gemset

To create a new gemset, execute a command like the one below:

$ rvm gemset create GEMSET-NAME

Select a gemset for a given Ruby version

To select a gemset for a given Ruby version, use this command:

$ rvm gemset use GEMSET-NAME

Share gems between all the gemsets

RVM defines a global gemset which is shared among all the gemsets for a specific Ruby version. To install a shared gem, execute:

$ rvm gemset use global
$ gem install rails
$ rvm gemset use GEMSET-NAME
$ gem list rails
Last modification July 29, 2020