Monday, July 23, 2007

Installing Ruby on Rails on Mac OSX

I'm in the early stages of studying Ruby on Rails and I'm already in the part where I'm installing it on my mac. I have a MAC OSX Tiger and zero knowledge RoR. There are tons of press release about how easy RoR is but I failed to find the one about how easy it is to install on a mac. But being the never-bows-down-to-a-challenge dude that I am, I raised the bar a notch by sipping from a tall glass of strong beer every time I would get to a dead end from a thanks-for-nothing installation tutorial and proceed to install.

Ok, to document everything and maybe help mac users who wants to install RoR, you can get any installer on the Net. Since I'm a newbie, instinctively, I got one of those "one-click-install" type (fortunately or not). It's pretty forward, until the part where you need to install rails. In mac terminal, when you type:

gem install

or
sudo gem install


and you get the error:

Could not find rails (>0) in any repository


you need to delete the source_cache. First you need to find it. To do that, do this:

gem env


then you do this:

sudo rm -f /usr/local/lib/ruby/gems/1.8/source_cache


use sudo because chances are, like me, you're the admin user on your mac; that means you don't have permission to delete source_cache which is owned by the system(super admin)

then try doing:


gem install


or

sudo gem install


if this still doesn't work, do this:

gem update


then again, do:

sudo gem install


After doing the above line, my installation went through.

My tall glass is now dry, eyes heavy and head numb. Tomorrow is another day.

No comments: