How to Install Ruby-Oci8

How to install ruby-oci8?

Slightly updated version of install of ruby-oci8 for 10.9/10.10/10.11OSX Mavericks/Yosemite/El Capitan - step-by-step:

  1. Go here: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
  2. Download the 64bit versions of instantclient-sqlplus, instantclient-sdk, instantclient-basic - the 32bit versions do not work with OSX 10.9
  3. Create directories at /opt/oracle
  4. Unzip instantclient-basic first, move to /opt/oracle (should add a folder - something like /opt/oracle/instantclient_11_2/)
  5. Unzip instantclient-sdk and move its contents to /opt/oracle/instantclient_11_2/
  6. Unzip instantclient-sqlplus and move its contents /opt/oracle/instantclient_11_2/
  7. Open Terminal (if you haven't already) and type...
  8. DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export DYLD_LIBRARY_PATH
  9. ORACLE_HOME=/opt/oracle/instantclient_11_2 export ORACLE_HOME
  10. cd /opt/oracle/instantclient_11_2
  11. ln -s libclntsh.dylib.11.1 libclntsh.dylib (creates a symbolic link)
  12. env
  13. verify that DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 (be sure there's no trailing / after instantclient_11_2)
  14. verify ORACLE_HOME=/opt/oracle/instantclient_11_2
  15. gem install ruby-oci8

Should work after that. The file structure should look similar to this:

Sample Image

Trouble installing ruby-oci8 gem

You have to set LD_LIBRARY_PATH to install ruby-oci8 gem. Here I am assuming you are using linux os. Try this on your terminal.

$ LD_LIBRARY_PATH=$ORACLE_HOME/lib
$ export LD_LIBRARY_PATH
$ gem install ruby-oci8

Edit:

If you uses mswin32 ruby, use the following command instead.

gem install --platform x86-mingw32 ruby-oci8
or
gem install --platform x64-mingw32 ruby-oci8

Let me know If you have any query or question.

Happy Coding

trying to install ruby oci8 with bundle install and i tried doing it seperate still not working

In order to compile the native extension gem ruby-oci8, whcih is required for active record oracle adapter, it needs to know the path to the oracle client.

  #check the path of your Oracle instanant client install
export LD_LIBRARY_PATH=/opt/oracle/instantclient:$LD_LIBRARY_PATH

$ bundle install

Cannot Install ruby-oci8 on Ubuntu 12.04LTS

I recently had to install oracle + ruby gem, here are the instructions for mac (but would work just as well for ubuntu). Full Instructions are at:

http://blog.codiez.co.za/2013/09/setup-oracle-instant-client-ruby-oci8-gem-mac/

The key is that the ruby-oci gem needs to know where the dynamic libraries are stored. For ubuntu you need to set: LD_LIBRARY_PATH

Grab the following files:

  • instantclient-basic-linux.x64-11.2.0.3.0.zip
  • instantclient-sqlplus-linux.x64-11.2.0.3.0.zip
  • instantclient-sdk-linux.x64-11.2.0.3.0.zip

Extract them and put them somewhere, and then add the following environment variables. See link for detailed instructions.

export ORACLE_BASE=/usr/local/oracle
export ORACLE_HOME=$ORACLE_BASE/product/instantclient_64/11.2.0.3.0
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$DYLD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_BASE/admin/network

Explanation of environment variables:

ORACLE_BASE: Where all the files are stored
ORACLE_HOME: The path to the actual client
LD_LIBRARY_PATH: Should point the the lib directory, make sure you have the SDK zip file extracted here
TNS_ADMIN: where to find your TNS_ADMIN file (not really necessary for ruby-oci gem)



Related Topics



Leave a reply



Submit