I\'m trying to install ruby-oci8 on OS X.
I\'ve tried installing both with and without sudo
.
Error Message without sudo
:
Begin by downloading oracle instantclient version 11.2 for 32 bit Linux from their website. Version 12 or later will not work with visual database (I always grabbed the .zip versions, so that's what the guide assumes. It also assumes the downloaded files are in the /tmp folder.). You will need the basic version, sqlplus, and sdk. Once those downloads are completed, execute the following commands in the terminal
sudo mkdir -p /opt/oracle
sudo cd /opt/oracle
sudo unzip /tmp/instantclient-basic-linux-11.2.0.4.0.zip
sudo unzip /tmp/instantclient-sqlplus-linux-11.2.0.4.0.zip
sudo unzip /tmp/instantclient-sdk-linux-11.2.0.4.0.zip
sudo apt-get install libaio1
sudo cd instantclient_11_2
sudo ln -s libclntsh.so.11.2 libclntsh.so
-Now, we'll need to tell our bash shell where the oracle client is located. So allow yourself to see hidden files, and open up $home/.bashrc with a text editor. Add the following line to the bottom of the file and then save it:
export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2
-Now source .bashrc to load the new settings with this command in the terminal:
source ~/.bashrc
-Now if we did everything correctly, we should be able to install the oracle database adapter gem. Try it with this command:
gem install ruby-oci8 -v '2.1.5'
The error message is somewhat verbose, but it basically says that you need to install the Oracle Client libraries and point the DYLD_LIBRARY_PATH
variable to that location.
If you are using MAC with El Capitan, the DYLD_* environment variables are ignored,due the latest embedded feature of System Integrity Protection (SIP).
SO if you wants to install ruby-oci8 with El Capitan, first you have to disable SIP.
Follow these steps to disable SIP:
If you still facing problem try this link http://blog.codiez.co.za/2013/09/setup-oracle-instant-client-ruby-oci8-gem-mac/
Slightly updated version of install of ruby-oci8 for 10.9/10.10/10.11OSX Mavericks/Yosemite/El Capitan - step-by-step:
DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export DYLD_LIBRARY_PATH
ORACLE_HOME=/opt/oracle/instantclient_11_2 export ORACLE_HOME
cd /opt/oracle/instantclient_11_2
ln -s libclntsh.dylib.11.1 libclntsh.dylib
(creates a symbolic link)env
Should work after that. The file structure should look similar to this:
This looked painful. I think I may have found a better way to resolve this (on Mac OS, at least).
Just run the following brew commands:
brew tap InstantClientTap/instantclient
brew install instantclient-basic
brew install instantclient-sqlplus
brew install instantclient-sdk
In case anyone else needs to install a legacy version of ruby-oci8 on Ruby 1.8.7 on mac osx el capitan, I had success installing ruby-oci8-2.1.2 using the following method. I think it will also work on other ruby-1.8.7 versions as well (ruby-oci8 < 2.2.0) but I haven't checked other versions:
cd /opt/oracle/instantclient_11_2
ln -s libclntsh.dylib.11.1 libclntsh.dylib
curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
ruby fix_oralib.rb -a
export OCI_DIR=/opt/oracle/instantclient_11_2
git clone https://github.com/kubo/ruby-oci8.git
git checkout ruby-oci8-2.1.2
when /darwin/
@@ld_envs = %w[DYLD_LIBRARY_PATH]
so_ext = 'dylib'
To this:
when /darwin/
@@ld_envs = %w[DYLD_LIBRARY_PATH OCI_DIR]
so_ext = 'dylib'
gem build ruby-oci8.gemspec
2potatocakes$ gem install ruby-oci8-2.1.2.gem
Building native extensions. This could take a while...
Successfully installed ruby-oci8-2.1.2
1 gem installed