I need to use Oracle’s SQL*Plus quite often from my Mac but Oracle’s support for OS X is sketchy to say the least.Â You can’t install the proper client on Intel machines, so you have to use the Instant Client instead.Â I also want to use gqlplus, which adds things like a command history to SQL*Plus.Â (You may be amused to know that SQL*Plus was once called UFI, meaning “User Friendly Interface”, not sure how it could be made less friendly really).Â After a bit of trial and error, I got it working.Â This is how I have it set up:
- I installed instantclient into its own directory
- I added this directory to PATH and to both LD_LIBRARY_PATH and DYLD_LIBRARY_PATH environment variables
- I put tnsnames.ora and login.sql (for commands to be run at login time) in my home directory
- I pointed the TNS_ADMIN and SQLPATH environment variables to my home directory
- I built and installed gqlplus in /usr/local/bin
I have also set up an alias so that gqlplus runs with the -d flag.Â This turns off the auto-completion which can make gqlplus slow to load.