Download the following files from Oracle
- instantclient-basic-macos.x64-11.2.0.4.0.zip
- instantclient-sdk-macos.x64-11.2.0.4.0.zip
Unzip downloaded files and after unzipping the download, move the sdk directory into the instantclient_11_2 directory
Create a directory /usr/local/share/oracle
, copy instantclient_11_2 here and edit for .bash_profile file adding following exports:
export ORACLE_HOME=/usr/local/share/oracle/instantclient_11_2
export DYLD_LIBRARY_PATH=$ORACLE_HOME/
export LD_LIBRARY_PATH=$ORACLE_HOME/
export VERSION=11.2.0.4.0
export ARCH=x86_64
export FORCE_RPATH=1
Reopen terminal or open a new tab to load environment variables. You can check they are loaded executing:
echo $ORACLE_HOME
echo $DYLD_LIBRARY_PATH
echo $ARCH
Create symbolic links for libclntsh.dylib.11.1 and libocci.dylib.11.1
cd $ORACLE_HOME
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
Download cx_Oracle from PyPI, copy it to $ORACLE_HOME directory and extract it
cd $ORACLE_HOME
tar -xzf cx_Oracle-5.2.1.tar.gz
cd cx_Oracle-5.2.1
env ARCHFLAGS="-arch $ARCH" python3 setup.py build
python setup.py install