location

How to Install CX_Oracle on Mac

|
👋 Thanks for reading! Things have changed since this was written, take it with a grain of salt ;)

Official Docs

Install Python

CX Oracle will not work with the mac bundled python. Install python with Homebrew.

brew install python3
pip3 install virtualenv

Next install CX_Oracle for python. If it will be used in a virtual env, create that first.

# create virtual env
python3 -m virtualenv venv

# install cx oracle
pip install cx_Oracle

Install Oracle Client

Download Oracle Client basic.

Unzip it into the final directory.

sudo mkdir -p /opt/oracle

Move the unzipped download into that folder.

Add links to the /lib folder to make cx_oracle accessible.

mkdir ~/lib
ln -s /opt/oracle/instantclient_12_2/libclntsh.dylib.12.1 ~/lib/

Create the folder for the tnsnames.ora file.

mkdir -p /opt/oracle/instantclient_12_2/network/admin