HOW-TO: Install SqlPlus and the Oracle Client v10.2 on Mac OS X Leopard 10.5.4

Posted by in Oracle on Unix Server

Today I wrote this script that can be used to install and configure SqlPlus on a Mac OS X. It was tested on a Leopard 10.5.4 machine.

1. Download from the Oracle website the Oracle Client for Mac OS X (Intel x86) Version and the SqlPlus:
– the Oracle Client ‘Instant Package – Basic’ []
– the Oracle Client ‘Instant Package – SqlPlus‘ []
2. Download the bash scripts and Last version can be found in the script page.

1. Set a root password and log in as root
# sudo passwd
# su –
2. Copy the files,, and into the directory /var/root.
3. Enter the home directory of the user root, change the permissions of the scripts and execute the installation script.
# cd
# chmod 755
# ./

Post-Installation: [Steps Required]
1. Make sure you know SID, SERVER and PORT of the server you want to connect.
2. Execute the script
# cd
# ./
3. Type: Oracle SID, Oracle Server, Oracle Server Port, Oracle Database Username, Oracle Database Password.

Installation Check:
1. To connect the Oracle DB via SqlPlus you can run the following command:

Your comment, error reports and improvement requests are always welcome ;D

# # # # #

26 thoughts

  1. Hi,
    Thanks for the detailed steps. After doing this I was unable to connect and was getting below error
    dyld: Library not loaded: /scratch/plebld/208/sqlplus/lib/libsqlplus.dylib
    Referenced from: /usr/bin/sqlplus
    Reason: image not found
    Then I have exported DYLD_LIBRARY_PATH variable
    bash-3.2# export DYLD_LIBRARY_PATH=/opt/oracle/instantclient_10_2
    bash-3.2# echo $PATH $DYLD_LIBRARY_PATH
    /bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin /opt/oracle/instantclient_10_2
    Later I tried connecting but still have some issue
    bash-3.2# sqlplus hr/hr@//

    SQL*Plus: Release – Production on Sun Aug 3 11:25:38 2008

    Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

    ORA-12170: TNS:Connect timeout occurred

    I am able to ping the Oracle host machine.
    bash-3.2# ping
    PING ( 56 data bytes
    64 bytes from icmp_seq=0 ttl=128 time=0.669 ms
    64 bytes from icmp_seq=1 ttl=128 time=0.971 ms
    64 bytes from icmp_seq=2 ttl=128 time=0.610 ms

    I tried increasing SQLNET.INBOUND_CONNECT_TIMEOUT = 360 in sqlnet.ora but nothing worked.
    Pls help

  2. Can you try to execute SqlPlus as root? Do you have the same error?

  3. Hi,
    Thanks for the prompt response. yes I tried as root. I uninstalled everything tried from scratch. Now i am getting below error.
    root# echo $PATH $DYLD_LIBRARY_PATH
    /bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin /opt/oracle/instantclient_10_2
    root# sqlplus hr/hr@//
    dyld: Library not loaded: /scratch/plebld/208/rdbms/lib/libclntsh.dylib.10.1
    Referenced from: /usr/bin/sqlplus
    Reason: image not found
    Trace/BPT trap

  4. Hi Vish,
    are you using Leopard 10.5.4?

    Try to run this

    # cd
    # chmod 755 .profile
    # nano .profile

    and add at the end of the file .profile the following strings:

    export TNS_ADMIN
    export ORACLE_HOME

    Then restart close the terminal and open it again.

  5. Question:
    This did not work for me. I am trying to connect to
    Oracle 7.3.4 and that maybe the problem.
    I know I can download ‘classes12’ and that is supposed to be the driver for this version of Oracle’s DB… but where do I put that
    Or, am I missing something…
    The error is:

    SQL*Plus: Release – Production on Thu Aug 14 10:43:30 2008

    Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

    Enter user-name: my_user_name
    Enter password: my_password
    ORA-12162: TNS:net service name is incorrectly specified

    Any help would be appreciated. Thanks.

  6. Hi Kerby,
    make sure that you specified correctly the SID.
    # cat /opt/oracle/tns/tnsnames.ora
    You can edit this file manually.
    # vi /opt/oracle/tns/tnsnames.ora

  7. I’m getting a similar error, but it’s with the webserver starting.

    dyld: NSLinkModule() error
    dyld: Library not loaded: /scratch/plebld/208/rdbms/lib/libclntsh.dylib.10.1
    Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20060613/
    Reason: image not found

    output from your instructions above:


    BASIC_README libclntsh.dylib.10.1 libocijdbc10.jnilib
    SQLPLUS_README libnnz10.dylib libsqlplus.dylib
    classes12.jar libocci.dylib libsqlplusic.dylib
    genezi libocci.dylib.10.1 ojdbc14.jar
    glogin.sql libociei.dylib sdk
    libclntsh.dylib libocijdbc10.dylib sqlplus

    also, I don’t have a .profile file

  8. Hi artulo,
    try to create manually the .profile file in the home directory as I described to Vish ;P

  9. i want to install oracle 10g client(32-bit) on Windows 64-bit OS. i am also able to install it..but the problem is that there is no ora driver in driver list. so i am unable to make DSN.
    can anybody help me?

  10. Yes, I am revisiting this. It still does not connect. I have the correct info and sid set properly. The error is: TNS could not resolve the connect identifier

  11. THANK YOU!!! It works!!

    I also ended up having to put the instantclient libraries into /usr/lib and /scratch/plebld/208/rdbms/lib, then creating symbolic links to libclntsh.dylib.10.1.

  12. Hi Kerby,

    # cd
    # ./

    then make sure that the information you are typing are right :P

  13. Hi pritesh,
    sorry but we cannot help you with windows… you should start to use Linux :P

  14. Hi,
    I got almost the same error over and over again.

    localhost:~ root# sqlplus
    dyld: Library not loaded: /scratch/plebld/208/rdbms/lib/libclntsh.dylib.10.1
    Referenced from: /usr/bin/sqlplus
    Reason: no suitable image found. Did find:
    /scratch/plebld/208/rdbms/lib/libclntsh.dylib.10.1: unknown file type, first eight bytes: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    /usr/lib/libclntsh.dylib.10.1: unknown file type, first eight bytes: 0x0B 0x00 0x00 0x00 0x14 0x05 0x00 0x00
    Trace/BPT trap

    I did set the Library Path and copied the libraries both to usr/lib and scratch/…. but nothing changes.

    Could you plz help me



  15. I got the instant client working just fine with this script but it only works insofar as I am logged in as user “admin” on my system. When I log in as user “root”, sqlplus fails with message:

    “PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20060613/’ – (null) in Unknown on line 0”.

    When I echo $DYLD_LIBRARY_PATH as user root it displays no set value. It works just fine when I change to user “admin” at the bash command shell.

    If I run a script with a line that reads “phpinfo()” and execute it via the command line as root, the OCI extension is listed as loaded. Furthermore I can execute Oracle function calls from php scripts so long as the scripts are called from the command line.

    When I instead call a webpage with phpinfo() the OCI8 extension is not listed as loaded.

    Lastly when apache2 starts, php throws an error message to its log file which says “PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20060613/’ – (null) in Unknown on line 0”

    Do I have a problem with variables not being persistent after reboot or being set across multiple users accounts? Perhaps when Apache is running it can’t talk to the instant client.

    Any ideas?

    –Mike C

  16. Attempting to install Oracle Administrator Client on MAC OS X 10.5.4. I log in as root, I set ORACLE_HOME and DYLD_LIBRARY_PATH then unzip the downloaded client software. No errors and for some reason no install logs. Anyway, when logged in as root or as myself when I try to launch sqlplus I receive the error:
    dylb: Library not loaded: /scratch/plebld/208/sqlplus/lib/libsqlplus.dylib
    Referenced from /Users/user1/Oracle/ohome/bin/./sqlplus
    Reason: image not found
    Trace/BPT trap

    Please help if you can.

  17. Pete Ludwig

    November 16, 2008

    I went as root to /etc/profile and added the following:

    # Oracle Client changes
    export TNS_ADMIN
    export ORACLE_HOME

    – please note two things:

    1. OSX is whiny about changing big boy files, so you’ll have to save with :w! in vi before you can :q out of there. I like putting stuff here I want across users, although the other good (better, safer) way to do it is to pick who accesses the file and just change their ~/.profile files by adding the above. Forcing yourself to login as root to do some web or dev DB stuff ain’t a good plan.

    2. bash (at least my current OSX version) doesn’t like the double quotes around the roughly exact same thing Danilo had written earlier, I just took them out. I was getting that crappy “dylb: Library not loaded: /scratch..” error until I changed that.

    Thanks for the scripts, Danilo. Saved me some time and headache getting this tweaky Mac version hooked up.

  18. Beiowolf

    April 23, 2009

    How to uninstall this on Mac OSX ?

  19. pklammer

    July 25, 2011

    i get the following error, can someone help me?

    dyld: Library not loaded: /b/227/rdbms/lib/libclntsh.dylib.10.1
    Referenced from: /usr/bin/sqlplus
    Reason: image not found
    Trace/BPT trap: 5

  20. Hi,

    I have Lion OS, i need to install SQL plus should i go about it



  21. Thank you! This finally led me to getting SQLPlus to work on Lion, which saves me a lot of hassle working via terminal server.

  22. oh, btw – @pklammer: I had this error as well. You need to add some lines to your ~.bash_profile:

    export TNS_ADMIN
    export PATH

    and source it (or open another Terminal tab).

  23. deepak

    May 22, 2012

    i got this error

    when i run sqlplus

    dyld: Library not loaded: /b/227/sqlplus/lib/libsqlplus.dylib
    Referenced from: /usr/bin/sqlplus
    Reason: image not found
    Trace/BPT trap: 5

  24. manichandra

    June 22, 2012

    i am getting this error. I tried twice from the scratch. I am using lion
    I changed .profile also.
    and i directly copied tnsnames.ora which my professor asked me to use.

    [MANICHANDRABHOOSHANs-MacBook-Pro:/] root# sqlplus cs457_9884/changeme@//
    dyld: Library not loaded: /b/227/rdbms/lib/libclntsh.dylib.10.1
    Referenced from: /usr/bin/sqlplus
    Reason: image not found
    Trace/BPT trap
    [MANICHANDRABHOOSHANs-MacBook-Pro:/] root#

  25. manichandra

    June 22, 2012

    and when i run ./
    I got this No file or directory message in the end. I don’t know its an error or no.

    inflating: __MACOSX/
    inflating: __MACOSX/

    3 archives were successfully processed.
    1 “zipfile” was a directory.
    ./ line 34: cd: /opt/oracle/instantclient_10_2: No such file or directory

    You can now execute the script to set up the tnsnames.ora
    After that you can connect your Oracle DB via Sqlplus using this command:

  26. Just wanted to share some pointers from my experience:

    * Instead of logging in as root, I was just able to everything using SUDO.
    * The latest version was 11.2, but 10_2 is hardcoded in the scripts. You will have to manually changed the filenames in the script, if you use a never version.
    * I got it working on OSX Mountain Lion
    * You will have issues with DYLD, I created an alias that sets up the right DYLD location: alias run_sqlplus=”DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2/ sqlplus”
    * I had to set the TNS_ADMIN variable for it tnsnames.ora to work correction: export TNS_ADMIN=/opt/oracle/tns/tnsnames.ora

    That’s it,