nativeInstallerruby

Get started with RVM

RVM (Ruby enVironment Manager) is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments from interpreters to sets of gems.

Every installed Ruby using RVM 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.

RVM also has a very flexible gem management system called “named gemsets”. These gemsets allows defining independent groups of gems, which is really convenient to maintain multiple projects with different set of gems. This is partially addressed by Bundler, but while Bundler just takes care of installing and selecting the appropriate Gem version, RVM completely isolate the gem sets into its own GEM_PATH. Also, not all your applications will be compatible with Bundler. It is also possible to use a combination of both, which will make sure you won’t get in any trouble when working with different gem requirements.

Because of the above mentioned features, RVM is a perfect asset for your development process but that does not mean it is not suitable for production environments thanks to its ability to make setting up rubies / gems very efficient. 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.

Prerequisites

To make use of RVM, you must have a compilation environment set up in your machine. You will need this compilation environment mostly to compile new Ruby versions but it will be also needed to compile some gems such as nokogiri.

Find a detailed list of the packages to install by executing:

$ rvm requirements

This will include more packages than really necessary as the Bitnami Ruby Stack already includes most of the required libraries.

Linux

Execute the command below to install the minimum list of required packages:

$ sudo apt-get install build-essential  autoconf automake libtool bison
Mac OS X

There are multiple ways of setting up the required environment in Mac OS X:

  • Install Xcode 4.1: This is the preferred way. There is no problems with using this version with the compilation of Rubies and the native gems.

  • Use osx-gcc-installer from Kenneth Reitz: This is a stripped down version of Xcode 4.1, which only includes GCC and the required libraries. The limitation of this solution is that it does not include certain headers, such as the Carbon/Cocoa headers, which are found in the main Xcode install (because of license restrictions from Apple). This means that some native gems will fail to compile. You could still get the header packs from Apple but you will have to be a registered Apple Developer.

  • Use Xcode 4.2+: These versions of Xcode use a non-compatible version of GCC. If you want to use them, you will need to start installing Xcode 4.1, and then upgrade, answering not to them when asked to remove prior versions. Then you will have to use /usr/bin/gcc-4.2 to compile.

Last modification September 5, 2018