Installing ruby-oci8

Installing ruby-oci8 requires some manual software dependency management outside of the normal installation process. The instructions below should help you. This takes into consideration the System Integrity Protection (SIP) built into the latest versions of MacOS.

Installation

  1. Install Homebrew
  2. Download the following packages from Oracle Technology Network (registration required) or ask your sysadmin.
  • instantclient-basic-macos.x64-12.2.0.1.0-2.zip
  • instantclient-sdk-macos.x64-12.2.0.1.0-2.zip
  • instantclient-sqlplus-macos.x64-12.2.0.1.0-2.zip
  1. Put the files you downloaded in ~/Library/Caches/Homebrew
  2. Install the Oracle InstantClient via Homebrew:
brew tap InstantClientTap/instantclient
brew install InstantClientTap/instantclient/instantclient-basic
brew install InstantClientTap/instantclient/instantclient-sdk
brew install InstantClientTap/instantclient/instantclient-sqlplus
  1. export OCI_DIR=$(brew --prefix)/lib
  2. gem install ruby-oci8 or bundle install if it’s required by your project.

Upgrading

Assuming you’ve already installed the ruby-oci8 gem and the InstantClient packages above, you’ll run into a Homebrew issue with updating.

  1. Update Homebrew: brew update
  2. Unlink all the installed InstantClient packages:
brew list | grep instantclient | while read pkg
do
    brew unlink $pkg
done
  1. See Step 2 in “Installation” and then come back here.
  2. Upgrade the InstallClient packages:
brew list | grep instantclient | while read pkg
do
    brew upgrade --cleanup $pkg
done
  1. See Steps 5 and 6 in “Installation”. You may want to remove the ruby-oci8 gem first.

Updated: