This blog post is for old style programmer who wish to install ruby via compiling the source code, like how I do it. This blog post is written in a just to know basis.

The source code of ruby can be downloaded from ruby’s official website http://www.ruby-lang.org/en/downloads/.

Dependency for Ruby and Ruby on Rails : libreadline, libyaml, libxml, libssl, zlib1g.

In ubuntu you can have these libraries installed via the command line ( or if you are so old fashion you may google and find the source code for these packages as well)

1
sudo apt-get install build-essentails zlib1g zlib1g-dev libreadline-dev libyaml-dev libssl-dev

After installing the dependency download the source code and extract it ( please not the installation will proceed if you miss some of the dependencies but missing then would make gem, bundle, irb to not function properly).

First extarct the code :

1
tar -zxvf [Name of ruby source code file].tar.gz

the configure the source code

1
./configure

the finally you make and install

1
make && sudo make install

To check if ruby is install you can use the command

1
ruby -v

or try out interactive ruby (irb)

1
irb

Now for those who are wondering how to install the latest version of rails, use the command:

1
sudo gem install rails