-
Notifications
You must be signed in to change notification settings - Fork 3
RVM Cheat Sheet
The Ruby environment is notoriously error prone. This has been known to cause problems for some Fastlane actions when using the system Ruby on OS X in particular. (Apple ships Ruby 2.0, which was deprecated in February 2016.) It is recommended to use RVM, rbenv or chruby to manage your Ruby environment and work with a more current Ruby (e.g. 2.4.1).
This is a list of common commands used to install, maintain and work with RVM. Some examples are specific to OS X. Most are universal.
See https://rvm.io for more information on RVM.
A functional development environment is required, with standard compilers and other build tools. On OS X, this means you have to install Xcode and the associated command-line build tools.
This is a one-time preparation step. RVM must verify its signature if GPG is available. Skip this if which gpg2
returns nothing on a Mac.
OS X:
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash
Note the initial backslash, recommended to avoid shell aliases (but not necessarily required). This command modifies your shell initialization files. RVM is a shell extension. These modifications allow it to be automatically loaded. If it's not automatically loaded (in a script, e.g.), load it with:
. ~/.rvm/scripts/rvm
RVM will install any required native dependencies when installing Ruby. It may prompt for a sudo
password if it must make any updates. Some operating systems (e.g. OS X) offer different methods of obtaining native dependencies. By default, on OS X, RVM will use Homebrew to install dependencies if it is available. If you would rather use MacPorts, e.g.,:
rvm autolibs macports
See https://rvm.io/rvm/autolibs for a full list of autolibs
options.
rvm get master
or
rvm get head
These commands are the same.
rvm reload
RVM automatically reloads when updated. Use this command in other shell windows after updating.
rvm list known
rvm install ruby-2.4.1
or
rvm install 2.4.1
[jdee@Jimmy-Dees-MacBookPro ~]$ rvm list
rvm rubies
ruby-2.0.0-p648 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
ruby-2.2.6 [ x86_64 ]
ruby-2.3.3 [ x86_64 ]
ruby-2.3.4 [ x86_64 ]
ruby-2.4.0 [ x86_64 ]
* ruby-2.4.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
rvm use 2.4.1 --default
rvm use 2.4.1
rvm use ruby-2.4.1
rvm use ruby # Uses the latest available release, which may have to be installed first
rvm use default # Uses whatever you set as the default
rvm use system
rvm system
rvm uninstall 2.4.1 # Retains sources
rvm remove 2.4.1 # Removes sources
rvm implode
RVM installs everything by default to a writable location under ~/.rvm
. Do not use sudo
when installing gems. It is not necessary and can lead to permission problems if used.
gem install bundler
Now the bundle
command is available in your path under ~/.rvm
. This will also work, e.g., with
the fastlane
gem: gem install fastlane
, and the fastlane
command is in your PATH
under
~/.rvm
. This will usually work quite well, but you'll be better off using bundle exec
when running
Fastlane with plugins.
gem update # Updates all installed gems
gem update bundler # Updates the bundler gem.
gem install bundler # Updates a gem that's already installed
gem update --system
This updates the gem
command itself. Again, don't use sudo
here.