The latest upgrade to OS X has proved a little fiddly for users of ruby. Any ruby gem that contains native code needs reinstalling so that this code can be recompiled to 64bit. You might think after doing that you are done and dusted…. but don’t forget your OCI8 library if you are using Oracle with your rails stack!

If you can’t start rails because of the following error then you will most likely need to recompile OCI8:

1
2
Missing these required gems:
  activerecord-oracle_enhanced-adapter

Now I’m assuming you installed the ruby OCI8 library manually, as I detailed in my post on getting oracle and rails to play together. Try firing up irb and seeing if you can require oci8:

1
2
irb(main):002:0> require 'oci8'
LoadError: no such file to load -- oci8lib

There’s your problem – we need to reinstall the OCI8 library. To save you looking back to my previous post I’ve just copied the instructions below (and altered them slightly as a new version of the library is now out).

Step 1: Download ruby-oci8

Download the latest tarball from the ruby-oci8 rubyforge page to your ~/Downloads directory. At the time of writing the latest is version 1.0.6.

Step 2: Make and install ruby-oci8

If you’ve followed the instructions from part 1 then you should have your oracle instant client installed in /opt/oracle/instantclient. If you’ve not installed the instant client yet then scoot off to part 1 and perform those steps before going any further. If you’ve installed it somewhere different then you will need to amend the following commands where appropriate:

1
2
3
4
5
6
7
cd ~/Downloads
tar xvzf ruby-oci8-1.0.6.tar.gz

cd ruby-oci8-1.0.6
ruby setup.rb config -- --with-instant-client=/opt/oracle/instantclient
make
sudo make install

Step 3: Test it

1
2
irb(main):001:0> require 'oci8'
=> true

You should now be able to use rubygems to load the oracle_enhanced adapter:

1
2
irb(main):002:0> gem 'activerecord-oracle_enhanced-adapter'
=> true

Fingers crossed your rails app should also work now.