I still use and develop on a Macbook Pro from March 2006, which has been my daily workhorse since then. I have better machines, but still find it good to use and travel almost exclusively with it, since it is the one platform I can develop and test Mac, Linux and Windows code on.
I found myself wanting to develop some Mac specific code to demonstrate a WLAN protocol communicating to a non-standard device, and decided that the traditional ruby front-end would be better served if it were Cocoa enhanced, and I’d been wanting to take a look at MacRuby for a while. Perfect opportunity I thought. Unfortunately, all of the out-of-the-box installations are targeting 64-bit environments, which my ancient Core Duo machine most certainly is not.
Rather than drop it, or switch to my quad core desktop machine, I decided to see what it would take to get it to work in a 32-bit environment, and what the requirements are for doing so.
PLEASE NOTE: This only got me to the point where I could compile and install MacRuby and create a sample application which appears to run. Since this is just a starting point and MacRuby fails lots of its tests (most notably hangs during the gcd tests), don't blame me if your computer catches fire or refuses to work. A lot more testing is required if this is to work reliably. As MacRuby says in their documentation, this MAY work, but it also may not work for you.
First of all, check you have a recent version of XCode. Everything should compile correctly using version 3.2.1 upwards. I run 3.2.2, so I was ok. If you have an earlier version, you’ll have to login (or register) to developer.apple.com and download a later release.
2nd hurdle was LLVM. This is the core optimisation which MacRuby requires to be installed before attempting anything else. There are several issues with this, first of which is the exact version required to get it to work. After searching and finding a number of recommendations, I settled on the svn release of 0.29 with revision number 127367 as recommended in the MacRuby README documentation.
That files says: to check out and build use the following commands:
svn co https://llvm.org/svn/llvm-project/llvm/branches/release_29@127367 vm
cd vm
env CC=/usr/bin/gcc CXX=/usr/bin/g++ ./configure --enable-bindings=none
--enable-optimized --with-llvmgccdir=/tmp
env CC=/usr/bin/gcc CXX=/usr/bin/g++ make
sudo env CC=/usr/bin/gcc CXX=/usr/bin/g++ make install
If you’ve cut and past the previous code block and it hasn’t thrown any errors, go bake a cake, or at least use another machine for a while, since this installation takes a very long time.
Once complete, you can check that the installation has succeeded by running
llvm-config --version
I’m using version MacRuby version 0.11, since that was the latest at time of writing.