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.
Pre-installation:
1. Download from the Oracle website the Oracle Client for Mac OS X (Intel x86) Version 10.2.0.4 and the SqlPlus:
- the Oracle Client ‘Instant Package – Basic’ [instantclient-basic-macosx-10.2.0.4.0.zip]
- the Oracle Client ‘Instant Package – SqlPlus‘ [instantclient-sqlplus-macosx-10.2.0.4.0.zip]
2. Download the bash scripts MacSqlPlus.sh and TNSconnectMac.sh. Last version can be found in the script page.
Installation:
1. Set a root password and log in as root
# sudo passwd
# su -
2. Copy the files instantclient-basic-macosx-10.2.0.4.0.zip, instantclient-sqlplus-macosx-10.2.0.4.0.zip, MacSqlPlus.sh and TNSconnectMac.sh 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 MacSqlPlus.sh TNSconnectMac.sh
# ./MacSqlPlus.sh
Post-Installation: [Steps Required]
1. Make sure you know SID, SERVER and PORT of the server you want to connect.
2. Execute the script TNSconnectMac.sh
# cd
# ./TNSconnectMac.sh
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:
# sqlplus DB_USER/DB_PASS@//DB_SERVER:DB_PORT/DB_SID
Your comment, error reports and improvement requests are always welcome ;D
Other Posts
« HOW-TO: Install PHP5, Oracle Client v10.2 and OCI8 on Ubuntu Server Linux
HOW-TO: Install PHP5, OCI8, the Oracle Client v10.2 and SqlPlus on Mac OS X Leopard 10.5.4 »
Comments
This entry was posted on Friday, July 25th, 2008 at 10:19 pm and is filed under Oracle on Unix Server. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Feed RSS 

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@//172.16.127.130:1521/XE
SQL*Plus: Release 10.2.0.4.0 – Production on Sun Aug 3 11:25:38 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-12170: TNS:Connect timeout occurred
I am able to ping the Oracle host machine.
bash-3.2# ping 172.16.127.130
PING 172.16.127.130 (172.16.127.130): 56 data bytes
64 bytes from 172.16.127.130: icmp_seq=0 ttl=128 time=0.669 ms
64 bytes from 172.16.127.130: icmp_seq=1 ttl=128 time=0.971 ms
64 bytes from 172.16.127.130: 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
Vish
Can you try to execute SqlPlus as root? Do you have the same error?
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@//172.16.127.130:1521/XE
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
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:
DYLD_LIBRARY_PATH=”/opt/oracle/instantclient_10_2″
export DYLD_LIBRARY_PATH
TNS_ADMIN=/opt/oracle/tns
export TNS_ADMIN
ORACLE_HOME=”/opt/oracle/instantclient_10_2″
export ORACLE_HOME
Then restart close the terminal and open it again.
Enjoy
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 classes12.zip?
Or, am I missing something…
The error is:
SQL*Plus: Release 10.2.0.4.0 – 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
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Any help would be appreciated. Thanks.
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
Bye
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/oci8.so
Reason: image not found
output from your instructions above:
ls
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
Hi artulo,
try to create manually the .profile file in the home directory as I described to Vish ;P
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?
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
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.
Hi Kerby,
# cd
# ./TNSconnectMac.sh
then make sure that the information you are typing are right :P
Hi pritesh,
sorry but we cannot help you with windows… you should start to use Linux :P
Bye
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: 0×00 0×00 0×00 0×00 0×00 0×00 0×00 0×00
/usr/lib/libclntsh.dylib.10.1: unknown file type, first eight bytes: 0×0B 0×00 0×00 0×00 0×14 0×05 0×00 0×00
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
Greets
Robert
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/oci8.so’ – (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/oci8.so’ – (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?
Thanks,
–Mike C
Attempting to install Oracle Administrator Client 10.2.0.4 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.
I went as root to /etc/profile and added the following:
# Oracle Client changes
DYLD_LIBRARY_PATH=/opt/oracle/instantclient_10_2
export DYLD_LIBRARY_PATH
TNS_ADMIN=/opt/oracle/tns
export TNS_ADMIN
ORACLE_HOME=/opt/oracle/instantclient_10_2
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.
Hi
How to uninstall this on Mac OSX ?