0

I'm trying to install ruby-oci8 (mac) using ruby-oci8 and unable to install.

When i try to install this gem.

gem install ruby-oci8

Its generate error for environment variable. I am unable to figure out this problem.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/tayyab/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160423-11068-8lu6zg.rb extconf.rb
checking for load library path... 
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/tayyab/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
    --with-instant-client
    --without-instant-client
/Users/tayyab/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby-oci8-2.2.1/ext/oci8/oraconf.rb:566:in `check_ic_dir': RuntimeError (RuntimeError)
    from /Users/tayyab/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby-oci8-2.2.1/ext/oci8/oraconf.rb:316:in `get'
    from extconf.rb:22:in `<main>'
  DYLD_LIBRARY_PATH is not set.
  checking DYLD_FALLBACK_LIBRARY_PATH...
    checking /Users/tayyab/lib... no
    checking /usr/local/lib... no
    checking /lib... no
    checking /usr/lib... no
  checking OCI_DIR...
---------------------------------------------------

Error Message:

  Set the environment variable DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or
  OCI_DIR to point to the Instant client directory.

  If DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH is set, the environment
  variable must be set at runtime also.

  If OCI_DIR is set, dependent shared library paths are checked. If the checking
  is passed, ruby-oci8 works without DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH.

  Note: OCI_DIR should be absolute path.
  Note: DYLD_* environment variables are unavailable for security reasons on OS X 10.11 El Capitan.

Any idea how to resolved it?

TayyabZahid
  • 187
  • 3
  • 15

3 Answers3

7

You need to perform almost the same steps as provided here https://stackoverflow.com/a/21443313/4439981 instead of 8.

  1. Replace DYLD_LIBRARY_PATH with OCI_DIR

    OCI_DIR=/opt/oracle/instantclient_11_2 export OCI_DIR
    
Community
  • 1
  • 1
0

Fews days back , i was also got same error.. try so many think and finally got solution was very simple .

El Capitan ships with a new OS X feature: System Integrity Protection (SIP), also known as “rootless” mode. This reduces the attack surface for malware. This was main reason which makes unable to set "DYLD_LIBRARY_PATH". So solution was disable this feature to ins

Follow these steps to disable SIP:

  1. Restart your Mac.
  2. Before OS X starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery.
  3. From the Utilities menu, select Terminal.
  4. At the prompt type exactly the following and then press Return: csrutil disable
  5. Terminal should display a message that SIP was disabled.
  6. From the  menu, select Restart.

    From the Utilities menu in Recovery select Terminal. Terminal view Use the Terminal in Recovery to enter the SIP-disabling command.

0

error message:

enter image description here

Fix:

export OCI_DIR=$HOME/../../opt/oracle/instantclient_11_2 

enter image description here

success:

enter image description here

Download link instantclient:

https://www.oracle.com/uk/database/technologies/instant-client/macos-intel-x86-downloads.html

N Djel Okoye
  • 950
  • 12
  • 10