Thursday, June 18, 2009

How to install ruby and related gems on Mac OS X (Leopard)


Type these commands into Terminal:

curl -O
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
sudo make install
cd ..

To verify that Ruby is installed and in your path, just type:

which ruby

You should see:



After installing ruby, move on to ruby gems the same way:

curl -O
tar xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo /usr/local/bin/ruby setup.rb
cd ..

Ruby on Rails and other gems

Now you are ready to install important gems:

sudo gem install rails

sudo gem install mysql

or do it in a single step like:

sudo gem install RedCloth termios rspec sake capistrano mongrel

Congratulations! You are done with the basic setup of ruby and rails.