Monday, February 16, 2009

Install Ruby and Rails From Source

You have the power. You can create Ruby and Rails from source by following the simple instructions in this post. The first four commands create the necessary environment for the source which is then downloaded and compiled using make.
sudo mkdir -p /usr/local/src
sudo chgrp admin /usr/local/src
sudo chmod -R 775 /usr/local/src
cd /usr/local/src
Download and compile in this folder.
curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
tar xzvf ruby-1.8.7-p72.tar.gz
cd ruby-1.8.7-p72
./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
make
sudo make install
cd ..
I found I needed to update my alias which I did by running this command
 alias ruby='/usr/local/bin/ruby'