Ruby / Oracle / Mac OS X pain
Environment setup is one of the worst aspects of software development. You can get all hyped up about the latest and greatest technology and techniques, but at some point you’ve got to get your environment set up so you can use them. I’ve spent a good part of this afternoon trying to get Ruby to work with an Oracle database on my Mac OS X box.
Simple huh? Nope. Mostly just old fashioned pain.
A bit of googling initially pointed me to the ruby-oci8 project, which provides a Ruby library for Oracle. I happily download and started working through the install instructions which involves compiling the library. Fine - except for the compilation problems. Seems my Oracle Instant Client install isn’t quite complete.
Next step is a trip to Oracle’s website, which is an altogether separate exercise in frustration - after eventually reviving my developer login (with the help of mailinator and Borat), I stumbled around clicking through a “terms of use - sell your soul agreement” for every… single… page… I eventually find the download I’m after. Cool.
I try to compile ruby-oci8 again, but this time I come up against:
Oracle doesn't support intel mac.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/223854
There are three solutions:
1. Compile ruby as ppc binary.
2. Wait until Oracle releases mac intel binary.
3. Use a third-party ODBC driver and ruby-odbc instead.
http://www.actualtechnologies.com/
By this time about 2 hours have gone by, and hair is being pulled out in clumps. Admittedly I would have known this if I’d just read the platform specific issues on the ruby-oci8 site.
By now it’s 6pm, and the evening round of CS is starting up. I’ll save this one for tomorrow. Maybe I’ll play around with ODBC, or possibly try using a JDBC driver and using JRuby instead.
The ironic part is that I’m just wanting to "quickly" mock up some code to test out something that will later be implemented properly in Java (oldschool, heavy Java). At this rate it probably would have been quicker to do something quick and nasty in Java and be done with it (which isn’t *that* bad with Eclipse). Lately though, I’m shuddering at the thought of file after file of needless case handling, redundant interfaces, xml config files, and over engineered Sun APIs - even for simple stuff. Environmental pain is probably the lesser of two evils in the long run.
March 10th, 2007 at 4:35 am
I went through the same thing, Total Pain. Apple need to build and release the intel binaries already!
March 10th, 2007 at 9:49 am
I think it’s Oracle who needs to do that, but yeah, it’s a total pain. Surely it wouldn’t be hard for them to recompile and release them - even as beta so us poor developers can use them.
June 1st, 2007 at 7:57 am
I added the OCI requirement and a link to the platform specific issues on the Rails Wiki. http://wiki.rubyonrails.org/rails/pages/HowtoConnectToOracle
I’m still trying to work through this issue myself. JRuby is giving me some fits.
If it wasn’t for the fact that this was Oracle (or DB2) things would be much easier.
August 10th, 2007 at 12:34 pm
Related digg article (spreading the word) ->
http://digg.com/apple/Oracle_to_Developers_on_Intel_Macs_FUCK_OFF
August 27th, 2007 at 9:19 pm
I published my experience how to setup Ruby and Oracle Instant Client on Intel Mac at
http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/