Thursday, March 26, 2009

Install Ruby on Leopard

Wanna to try out Ruby On Rail long time ago but just dont have time the get it install on my Mac, so tonight is the time. Although Leropard ship with Ruby package, it is not up to dated, and beside it does not has MYSQL C Binding, there are more extra steps need to be perform to get ruby fully function on Leopard. There are already many posts out there show how to configure it. I will summary the main steps here and provides a list of links that i use as a references.
1. Log in as a root
2. Update gem (The one ship in leopard is out of date)
gem update --system
3. Install the latest rails (current 2.2)
gem install rails -v=2.2.2
4. Install MYSQL C binding to improve mysql performance (the tricky one)
=> Use the leopard dvd install xcode tool
=> Run: sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-
=>Choose option 3: mysql 2.7 (ruby)

To test Rails,
$ rails demo
$ cd demo
$ ruby script/server
veiw page at: http://localhost:3000


Ruby Installation

C Binding issue on Leopard

Detail on how to fix the problem

More detail on C Binding