# Installing cx_Oracle (x86_64) for Mac OSX (tested on El Capitan 10.11.4) Assume you've got [homebrew](http://mxcl.github.com/homebrew/) installed. Assume python is installed through brew install python --universial ## Install instant client Download the following files from [Oracle](http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html) * instantclient-basic-macos.x64-11.2.0.4.0.zip * instantclient-sdk-macos.x64-11.2.0.4.0.zip Install export ORACLE_HOME=/usr/lib/share/oracle mkdir -p $ORACLE_HOME cd $ORACLE_HOME tar -xzf instantclient-basic-macos.x64-11.2.0.4.0.zip tar -xzf instantclient-sdk-macos.x64-11.2.0.4.0.zip ln -s libclntsh.dylib.11.1 libclntsh.dylib ln -s libocci.dylib.11.1 libocci.dylib curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb ruby fix_oralib.rb --absolute-path ## Install cx_Oracle Download source code of cx_Oracle (https://sourceforge.net/projects/cx-oracle/files/5.1.2/) * cx_Oracle-5.1.2.tar.gz Install export DYLD_LIBRARY_PATH=$ORACLE_HOME export LD_LIBRARY_PATH=$ORACLE_HOME export OCI_LIB_DIR=$ORACLE_HOME export OCI_INC_DIR=$ORACLE_HOME/sdk/include mkdir ~/cx cd ~/cx tar -xzf cx_Oracle-5.1.2.tar.gz python setup.py build install If there is some permission problem during "python setup.py", don't use "sudo" but try to use "chown" to get permission. ## Fix cx_Oracle.DatabaseError: ORA-21561: OID generation failed echo "127.0.0.1 $(hostname)" | sudo tee -a /etc/hosts ## Test Run python and try to import cx_Oracle import cx_Oracle con = cx_Oracle.connect ('username/password@hostname:port/sid') print(con.version) con.close() You may get some UserWarning but that's fine. If there is some error then something is wrong. ## Refrences * https://gist.github.com/thom-nic/6011715 * https://gist.github.com/kubo/8a45c653d06040c30135 * https://sourceforge.net/p/cx-oracle/mailman/message/34534872/ * https://github.com/joeferner/node-oracle/issues/47#issuecomment-38309484