Skip to content

Instantly share code, notes, and snippets.

@adamzaninovich
Last active December 20, 2015 16:09
Show Gist options
  • Save adamzaninovich/6159092 to your computer and use it in GitHub Desktop.
Save adamzaninovich/6159092 to your computer and use it in GitHub Desktop.

Installing Oracle oci8 gem on Mac OS X 10.8

Install Oracle Instant Client Packages

Download Instant Client Packages

Download the following packages from Oracle Technology Network.

You have to sign up for an Oracle Technology Network account, which is lame, Oracle, c'mon.

  • Instant Client Package - Basic or Basic Lite
  • Instant Client Package - SDK
  • Instant Client Package - SQL*Plus

Note: use 32-bit packages for 32-bit ruby even though the OS is 64-bit.

Installing

Run the following (assuming the zip files were saved to your Downloads folder):

sudo mkdir -p /opt/oracle
cd /opt/oracle
sudo unzip $HOME/Downloads/instantclient-basic-macos.*.zip
sudo unzip $HOME/Downloads/instantclient-sdk-macos.*.zip
sudo unzip $HOME/Downloads/instantclient-sqlplus-macos.*.zip
cd instantclient_11_2/ # yours may be a different version
sudo ln -s libclntsh.dylib.11.1 libclntsh.dylib # yours may be a different version

Add this to your shell environment (.bash_profile or similar):

export DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 # yours may be a different version

Setup Ruby and Other Miscellany

Run

ruby -r mkmf -e ""

If it doesn't error, you're fine, if it does, you're screwed, sorry.

Also, I assume you can compile shit. If not, how did you get this far?

Install the Gem

Pray to any and all entities you see fit, and perform all applicable magical spells, etc.

Run

gem install ruby-oci8

It probably didn't work, sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment