Table of Contents

RVM

Usage

Installation

  1. \curl -L https://get.rvm.io | bash -s stable - install stable version
  2. Add to ~/.zshrc, ~/.bashrc:

    ~/.zshrc and ~/.bashrc

    export PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
    [[ -r $HOME/.rvm/scripts/completion ]] && . $HOME/.rvm/scripts/completion
  3. Logout/Login to complete the installation.

Get State

Install Ruby

  1. rvm install 1.9.3 --autolibs=read-only - install Ruby of specific version;
  2. rvm gemset create rails3myproject - creates gemset with rails3myproject name;
  3. rvm use 1.9.3@rails3myproject --default - use Ruby 1.9.3 with rails3myproject gemset for new shells;
  4. rvm rubygems current or rvm rubygems latest - install the most recent RubyGems that RVM knows about;
  5. rvm rubygems 1.8.29 - install version 1.8.29 of RubyGems;
  6. gem install rails -v 3.2.15 - install specific rails in current gemset;
  7. gem install bundler - install Bundler;
  8. rvm use 1.9.3@rails3 --create --default - short way to create and use specific Ruby&Rails for current and new shells;
  9. rvm wrapper ruby-name - create symlinks in ~/.rvm/bin for specific Ruby version;
  10. rvm wrapper default --no-prefix - create symlinks in ~/.rvm/bin for default Ruby version.

Upgrading

Remove Unused

Useful Commands

Separate Ruby for Projects

Create $project/.rvmrc file with rvm use RubyVersion@projectname for example rvm use 1.9.3@rails3.

Typical Scanarios

Redmine installations:

Redmine deployments

command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm reload
rvm install 2.4.10 --autolibs=read-only # Redmine only
rvm use 2.4.10@global --create --default # Redmine only
gem uninstall bundler; gem install bundler # Temporary workaround: 1.12.3 requires to unlock nproc limits protection
rvm wrapper regenerate bundle # updates symlinks in ~/.rvm/bin
cd redmine
bundle update
bundle install --no-deployment --without development test # Redmine only
paxctl -m `which ruby` # Hardened Gentoo only