Ruby: Difference between revisions

From Leo's Notes
This page was last edited on 11 December 2015, at 23:41.
m terminal highlight
No edit summary
Line 7: Line 7:
# curl -sSL https://rvm.io/mpapis.asc {{!}} gpg2 --import -
# curl -sSL https://rvm.io/mpapis.asc {{!}} gpg2 --import -
# curl -L get.rvm.io {{!}} bash -s stable
# curl -L get.rvm.io {{!}} bash -s stable
... or if you want ruby:
# curl -L get.rvm.io {{!}} bash -s stable --ruby
}}
}}


Line 21: Line 24:
| user
| user
| {{code|~/.rvm}}
| {{code|~/.rvm}}
| {{code|~/.rvm/scripts/rvm}}
| {{code|~/.rvm/scripts/rvm}} (don't invoke, {{code|source}} the file)
|}
|}



Revision as of 23:41, 11 December 2015

The easiest way to get Ruby running is to use RVM.

Ruby via RVM

Installation

Install RVM. Their installer script requires package signatures to match so importing their key is required.

# curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
# curl -L get.rvm.io | bash -s stable

... or if you want ruby:
# curl -L get.rvm.io | bash -s stable --ruby

Depending if the installer was executed as a super user, RVM will be installed to:

User RVM Location Profile Script
root /usr/local/rvm /etc/profile.d/rvm.sh
user ~/.rvm ~/.rvm/scripts/rvm (don't invoke, source the file)

Source the profile script in order to include RVM into the path. Otherwise, execute the rvm script manually.

Install the desired version of ruby. If you are not running this as root, the script will attempt to install them via sudo. The Ruby dependencies I needed were installed with:

# yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make  bzip2 autoconf automake libtool bison iconv-devel sqlite-devel
# rvm install 2.2.3

Usage

As a normal user, source the profile script and use gem/ruby as you normally would.

Custom ruby gems will be installed in ~/ruby/gems. You may need to define the gems path manually by running GEM_PATH=$GEM_PATH:$HOME/ruby/gems