Skip to content

Instantly share code, notes, and snippets.

@tslmy
Forked from mmasashi/README.md
Last active August 11, 2018 18:03
Show Gist options
  • Save tslmy/96ef4586dc7548e748aabaece0227252 to your computer and use it in GitHub Desktop.
Save tslmy/96ef4586dc7548e748aabaece0227252 to your computer and use it in GitHub Desktop.
Install Oracle instant client (sqlplus) v12.1 on macOS

Install Oracle instant client (sqlplus) on MacOSX

  1. Get Oracle instant client for MacOSX
  1. Unarchive downloaded zip files into a same directory
  • ex: $HOME/Downloads/instantclient_12_1
  1. Create install.sh inside this instantclient_12_1 folder and copy the following code and past it on that file.
  2. In a terminal, cd into this instantclient_12_1 folder, then chmod +x install.sh to make this script file executable.
  3. Run install.sh by sudo ./install.sh then type your password.
  4. Add source /usr/local/share/instantclient/instantclient.sh to your ~/.bashrc file (also prompted when the script finishes).
#!/bin/bash
set -e
export ORACLE_VERSION="12.1.0.2.0"
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/bin
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/jdbc/lib
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/rdbms/jlib
mkdir -p /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/sqlplus/admin
mv sdk /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib/
mv ojdbc* /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/jdbc/lib/
mv x*.jar /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/rdbms/jlib/
mv glogin.sql /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/sqlplus/admin/
mv *dylib* /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib/
mv *README /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/
mv * /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/bin/
cd /usr/local/bin
ln -s ../Oracle/product/instantclient/$ORACLE_VERSION/bin/sqlplus sqlplus
cd /usr/local/Oracle/product/instantclient/$ORACLE_VERSION
mkdir -p share/instantclient
cd /usr/local/share
ln -s ../Oracle/product/instantclient/$ORACLE_VERSION/share/instantclient/ instantclient
cd /usr/local/Oracle/product/instantclient/$ORACLE_VERSION/lib
ln -s libclntsh.dylib.12.1 libclntsh.dylib
echo "
export ORACLE_BASE=/usr/local/Oracle
export ORACLE_HOME=\$ORACLE_BASE/product/instantclient/$ORACLE_VERSION
export DYLD_LIBRARY_PATH=\$ORACLE_HOME/lib
export OCI_DIR=\$DYLD_LIBRARY_PATH
export TNS_ADMIN=\$ORACLE_BASE/admin/network
" > /usr/local/share/instantclient/instantclient.sh
echo "Done!"
echo
echo "Next step: Add the following code to your ~/.bashrc"
echo "source /usr/local/share/instantclient/instantclient.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment