14 September 2009

Howto Upgrade Rails on Mac 10.5.8 (with XAMPP and Minimalist Xcode)

Nowadays I really like to tinker with RoR (Ruby on Rails). You know, a real (web) programmer/developer/designer has to know more than one framework/cms/tech/script lang. Mac actually has RoR itself included since the Leopard version, but as I checked, its version was 1.2.6, while the current version of rails is 2.3.4.

For a new learner, there's not so much differences between those versions, but as usual, I like the newest, the latest version available, though it maybe give me a lot of troubles.

My current development box is Mac OS X 10.5.8 on Aspire One 110L (hacked to 2.5" 160GiB SATA HDD and 1,5 GiB of RAM). I've installed XAMPP and MAMP at the same time (latest version, of course :)

According to ADC (Apple Dev Connection), the rails upgrade process was easy:
1. sudo gem update --system
2. sudo gem install rails
3. sudo gem update rake
4. sudo gem update sqlite3-ruby

So, it must be easy... Ok, step 1-3 successfully executed, I prefer not to run the forth step, 'coz 1-3 is enough. I have a sample rails app I've developed before(named Solidyne), so it's the time to upgrade the app itself:

$ rails solidyne [enter]

Note that we have to choose which file replaces what, like database, route, etc shouldn't be overwritten.

Ok, try to run Solidyne with:

$ script/server

And access it via Safari.... Oops, error!

It seems Solidyne couldn't communicate with MySQL server, which is from XAMPP package. Seems the mysql-ruby deleted after the upgrade. Ok, easy install with

$ sudo gem install mysql

Wow, error! Xcode needed. You know, plain install of Xcode takes Gigs of HDD space, so I just installed DevSDK, GCC-4.0, and DeveloperToolsCLI, minimum requirement for building something, I guess (after analyzing each package with Pacifist).

$ sudo gem install mysql

Oops, error again, it said something about lib, header, etc. Tried with:

$ sudo gem install mysql -- --with-mysql-config=/Applications/XAMPP/xamppfiles/bin/mysql_config

Well done, some improvements, but still failed looking for header. Hmm, seems like XAMPP development had to be downloaded. But, currently my connection is so slow, so fetching some 23MiB would take some hours.

Try to look for header from MySQL_Mac...dmg I've downloaded weeks ago, open it using Pacifist, and extract the folder 'include' to XAMPP base dir, and then re-execute the last command,and succeeded. Still has some warnings due to different version between mysql binary and mysql header, but who cares?

$ script/server

Accessing through http://localhost:3000, and it works as expected.

0 tanggapan: