Get started with rbenv

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

rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments.

Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems. This is convenient if you need to maintain multiple projects, dependent on different Ruby versions. It will also allow you to test your application in multiple Ruby versions so you will have a consistent environment from development, through testing, and into production.

For more information on rbenv, check the official GitHub repository.

List the installed Ruby versions

To list the installed Ruby versions in your machine with rbenv, run the following command:

$ rbenv version

You should see an output message similar to this:

* system (set by /home/bitnami/.rbenv/version)

Install a Ruby version

To install a new Ruby version, use the rbenv install command:

$ rbenv install VERSION

NOTE: Replace the VERSION placeholder with an appropriate Ruby version, i.e. 2.4.0.

Use a specific Ruby version for a project

To use a specific Ruby version for a project, use the rbenv local command:

$ rbenv local VERSION

NOTE: Replace the VERSION placeholder with an appropriate Ruby version, i.e. 2.4.0.

Approach B: Self-contained Bitnami installations

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

Last modification July 29, 2020