Last Updated: February 25, 2016
·
351
· kjtanaka

Install Ruby from source on a different location

Here's an example, installing 2.1.0 from source. The source tarball is available on this link http://www.ruby-lang.org/en/downloads/.

wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz
tar zxvf ruby-2.1.0.tar.gz
cd ruby-2.1.0
./configure --prefix=/opt/ruby-2.1.0
make
make install

Then, add these 2 lines on ~/.bashrc or ~/.bash_profile.

export PATH=/opt/ruby-2.1.0/bin:$PATH
export MANPATH=/opt/ruby-2.1.0/share/man:$MANPATH