Oracle Instant Client on Mac OS X

A while back I broke down to the peer pressure in the APEX community (you know who you are ;-) and bought a Mac Book Air. I’m still learning the ropes and one thing that took some time to get working was the Oracle Instant Client. Installing it isn’t as straightforward as installing the Instant Client on Windows.

I finally got it working and thought I’d post what I did for others that are new to OS X.

Download Instant Client

First you’ll nee to download the Instant Client for OS X. I downloaded the following files for Version 11.2.0.3.0 (64-bit):

  • instantclient-basic-macos.x64-11.2.0.3.0.zip
  • instantclient-sqlplus-macos.x64-11.2.0.3.0.zip

Unzip both files and put their contents in /oracle/instantclient_11_2/

Setting Paths

You’ll need to set the appropriate paths to load by default in Terminal. Open Terminal and run:

1
2
3
4
5
6
7
8
9
10
11
12
vi ~/.bash_profile

# Add the following to the file:

DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/oracle/instantclient_11_2
export DYLD_LIBRARY_PATH

PATH=$PATH:/oracle/instantclient_11_2/
export PATH

#Create this directory and put your tnsnames.ora file in it
TNS_ADMIN=/oracle/instantclient_11_2/network/admin/

Running SQL*Plus

Now when you open a new terminal window you should be able to run SQL*Plus

1
2
3
#ex: sqlplus username/[email protected]//server:port/sid
sqlplus system/[email protected]//localhost:1521/XE
#or use a connection string leveraging a tnsnames entry

Additional Addons

When using SQL*Plus in Windows you can use the Up arrow to get your previous command. If you do that in Linux you’ll get some weird character. The good news is that there’s a program to resolve it called rlwrap. CJ Travis has a good post on how to install rlwrap of Mac OS X.