How to install ruby-oci8?

后端 未结 11 1441
一生所求
一生所求 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 08:46

    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'
    
    0 讨论(0)
  • 2020-12-24 08:47

    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.

    0 讨论(0)
  • 2020-12-24 08:55

    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:

    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.

    If you still facing problem try this link http://blog.codiez.co.za/2013/09/setup-oracle-instant-client-ruby-oci8-gem-mac/

    0 讨论(0)
  • 2020-12-24 08:56

    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:

    enter image description here

    0 讨论(0)
  • 2020-12-24 08:56

    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
    
    0 讨论(0)
  • 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
    0 讨论(0)
提交回复
热议问题