Install SQL*Plus on MacBook

Refer: https://tomeuwork.wordpress.com/2014/05/12/how-to-install-oracle-sqlplus-and-oracle-client-in-mac-os/
Refer: https://halpjira01.flagship.hal.com:9443/confluence/pages/viewpage.action?pageId=46664178

Instructions for this setup were taken from this blog post and massaged to reflect the current version number of the Oracle application.

Download the following two files from the Oracle website: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html

"Instant Client Package - Basic"
"Instant Client Package - SQL*Plus"
Extract the files and create the proper directory structure

Open the terminal and unzip the downloaded files
$ unzip -qq instantclient-basic-macos.x64-12.1.0.2.0.zip
$ unzip -qq instantclient-sqlplus-macos.x64-12.1.0.2.0.zip
These will be extracted into a single directory: instantclient_12_1

Create the expected directory structure
$ mkdir -p /Applications/oracle/product/instantclient_64/12.1.0.2.0/{bin,lib,jdbc/lib,rdbms/jlib,sqlplus/admin,network/admin}

Transfer files over to the new directory
$ ORACLE=/Applications/oracle/product/instantclient_64/12.1.0.2.0
mv ojdbc* $ORACLE/jdbc/lib/
mv x*.jar $ORACLE/rdbms/jlib
mv glogin.sql $ORACLE/sqlplus/admin
mv *dylib* $ORACLE/lib/
mv *README $ORACLE
mv ./* $ORACLE/bin/

Add tnsnames.ora to /Applications/oracle/product/instantclient_64/12.1.0.2.0/network/admin/
You should be able to get this file from another dev

Set up the environment variables
$ cd ~ && vi ~/.bash_profile

Add the following exports to .bash_profile
export ORACLE_HOME=/Applications/oracle/product/instantclient_64/12.1.0.2.0
export PATH=$ORACLE_HOME/bin:$PATH
export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib

Update .bash_profile
$ source ~/.bash_profile

After all that, you should now be able to run SQL*Plus from the command line.

Leave a Reply