This is an old revision of the document!
RVM
Usage
Installation
- \curl -L https://get.rvm.io | bash -s stable - install stable version
- 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
- Logout/Login to complete the installation.
Get State
- rvm list - show currently installed rubies;
- rvm list known - show all known RVM installable Rubies;
- rvm gemset list - list installed gemsets for selected Ruby version;
- rvm info - show the current environment information for current ruby;
- rvm gemdir - gem directory of the currently selected ruby.
Install Ruby
- rvm install 1.9.3 --autolibs=read-only - install Ruby of specific version;
- rvm gemset create rails3myproject - creates gemset with rails3myproject name;
- rvm use 1.9.3@rails3myproject --default - use Ruby 1.9.3 with rails3myproject gemset for new shells;
- rvm rubygems current or rvm rubygems latest - install the most recent RubyGems that RVM knows about;
- rvm rubygems 1.8.29 - install version 1.8.29 of RubyGems;
- gem install rails -v 3.2.15 - install specific rails in current gemset;
- gem install bundler - install Bundler;
- rvm use 1.9.3@rails3 --create --default - short way to create and use specific Ruby&Rails for current and new shells;
- rvm wrapper ruby-name - create symlinks in ~/.rvm/bin for specific Ruby version;
- rvm wrapper default --no-prefix - create symlinks in ~/.rvm/bin for default Ruby version.
Upgrading
- rvm get stable - update to the latest stable version
Remove Unused
- rvm gemset delete rails2 - remove the entire gemset directory 'rails2';
- rvm rubygems remove - remove the different version installed of RubyGems;
- rvm uninstall 1.8.7 - uninstall Ruby-1.8.7 but keep sources;
- rvm remove 1.8.7 - uninstall Ruby-1.8.7 with sources.
Useful Commands
- rvm reset - reboot RVM;
- rvm implode - fully remove RVM;
- rvm use system - use System's Ruby version;
- rvm gemset export - export gemset to default.gems;
- rvm gemset import default.gems - install gemset from default.gems list.
Separate Ruby for Projects
Create $project/.rvmrc file with rvm use RubyVersion@projectname for example rvm use 1.9.3@rails3.
Typical Scanarios
Redmine / Gitorious installations:
Redmine/Gitorious deployments
curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm rvm reload rvm install 2.0.0 --autolibs=read-only # Gitorious only rvm install 2.1.5 --autolibs=read-only # Redmine only rvm use 2.0.0@global --create --default # Gitorious only rvm use 2.1.5@global --create --default # Redmine only rvm wrapper default --no-prefix # updates symlinks in ~/.rvm/bin gem install bundler cd site && bundle install --deployment # Gitorious only cd redmine && bundle install --no-deployment --without development test # Redmine only