Install Ruby on Rails from source

Published April 01, 2015

As of April 1, 2015, the latest version of Ruby [stable] is 2.2.1. I'm installing it from source to get latest and the greatest. This is a log of Ruby installations on my personal and office MacBooks, and development and production servers at work.

NOTE: I do not use rvm or rbenv because I like to have all my apps running with the same version of Ruby. If you have to run apps with different versions of Ruby, you'll need to install rvm or rbenv first.

Install dependencies and libraries

First, install the dependencies and libraries. We'll make sure to include support for OpenSSL and build tools.

On a Mac, assuming that you have Xcode tools and Homebrew installed:

xcode-select --install
brew install openssl

Find the openssl path:

brew --prefix openssl

It should return something like this:

/usr/local/opt/openssl

On Debian, run as root:

apt-get update
apt-get upgrade
apt-get install wget build-essential libssl-dev libpcre3-dev libcurl4-openssl-dev

On CentOS, run as root:

yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel

Download and install

Run this:

mkdir ~/downloads
cd ~/downloads
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.gz
tar -xzvf ruby-2.2.1.tar.gz
cd ruby-2.2.1

If you're on a Mac, use the configure command with this option:

./configure /usr/local/opt/openssl

If you're on Debian or CentOS, use the default command:

./configure

Continue the build:

make
sudo make install

Check if Ruby is installed with

ruby -v

You should get something like this.

ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]

Install Rails

sudo gem install rails

After several minutes, you will end up with Rails 4.2.1. Verify it with:

rails -v

You should see something like this.

Rails 4.2.1

Now, you can create your Ruby on Rails apps.

Stay tuned for more articles here.

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: April 01, 2015.     This post was originally written on April 01, 2015.