Skip to content

Instantly share code, notes, and snippets.

@Johnytran
Forked from jamesfwz/RVM.md
Last active August 29, 2015 14:08
Show Gist options
  • Save Johnytran/55599a17e859093bc085 to your computer and use it in GitHub Desktop.
Save Johnytran/55599a17e859093bc085 to your computer and use it in GitHub Desktop.

Installing RVM

# install RVM
curl -L https://get.rvm.io | bash -s stable

# runs RVM
source /etc/profile.d/rvm.sh

# Setups required files for RVM
rvm requirements --autolibs=enable

Ruby Version Management

  • RVM manages your ruby installation
# Install Ruby
rvm install 2.0.0

# Config RVM to use ruby 2.0.0
rvm use 2.0.0
rvm --default 2.0.0

Gemset Management

  • RVM manages your Gem dependencies by allowing you to install Gems in its own directory
  • If your project directory has a Gemfile (which just contains a single-line text of your project name), RVM will bundle gems in its directory for that project
  • RVM also has a default and global gemset
    global: When a gemset is installing a gem, it will first lookup in the global gemset to find if it is already downloaded. Hence, it makes installing faster. It is a good idea to pre-install many gems in your global so your projects starts faster.
    default: If a directory does not have a Gemfile, it will automatically use this gemset. (Why would you do this?)
  • Be sure to install bundler: gem install bundler
# Recipe to install gems into gemset
# List all your gemsets
rvm gemset list

# Use the global gemset
rvm gemset use global

# Create your Gemfile and then run bundle install
# Gems are installed into your global gemset

Notes

  • RVM stores all the gems in ~/.rvm/gems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment