How to install ruby-oci8?

后端 未结 11 1541
一生所求
一生所求 2020-12-24 08:24

I\'m trying to install ruby-oci8 on OS X.

I\'ve tried installing both with and without sudo.

Error Message without sudo:

         


        
11条回答
  •  一整个雨季
    2020-12-24 09:01

    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:

    1. Go here: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html Download the 64bit versions of instantclient-basic, instantclient-sdk, instantclient-sqlplus (I'm using the -macos.x64-11.2.0.4.0 versions)
    2. Copy the zip files to /opt/oracle and unzip each of them. It should extract them to /opt/oracle/instantclient_11_2
    3. cd /opt/oracle/instantclient_11_2
    4. ln -s libclntsh.dylib.11.1 libclntsh.dylib
    5. curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
    6. Be sure to append the -a flag when running the script, this will make the script fix the libs using an absolute path rather than an @rpath/*.dylib path which ends up choking the gem build process. (read the fix_oralib.rb script first if you want to check). Anyways, run: ruby fix_oralib.rb -a
    7. export OCI_DIR=/opt/oracle/instantclient_11_2
    8. Now grab the ruby-oci8 source git clone https://github.com/kubo/ruby-oci8.git
    9. Checkout the version you want to install (I needed 2.1.2) git checkout ruby-oci8-2.1.2
    10. Edit this file: ruby-oci8/ext/oci8/oraconf.rb and change this line:

    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'

    1. Now change back into the root directory of the gem itself and build the gemspec: gem build ruby-oci8.gemspec
    2. 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

提交回复
热议问题