At some point in the past I followed directions in "Oracle Database Client Installation Guide for Apple Mac OS X (Intel)" so that I could use sqlplus on my MacBook. Following the directions, I set the DYLD_LIBRARY_PATH environment variable in my .bashrc.
Today, I noticed this:
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Setting DYLD_* vars can break dynamic linking.
Hmm, what to do? Ignore? Fix? Google?
The top google hit was "Oracle sqlplus and instant client on Mac OS/X without DYLD_LIBRARY_PATH".
Everything is Casey's blog checked out:
$ which sqlplus
$ otool -L /Applications/instantclient_11_2/sqlplus
/ade/b/1891624078/oracle/sqlplus/lib/libsqlplus.dylib (compatibility version 0.0.0, current version 0.0.0)
/ade/b/2649109290/oracle/rdbms/lib/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
When I unset the variable, sqlplus stopped working:
$ unset DYLD_LIBRARY_PATH
dyld: Library not loaded: /ade/b/1891624078/oracle/sqlplus/lib/libsqlplus.dylib
Referenced from: /Applications/instantclient_11_2/sqlplus
Reason: image not found
Trace/BPT trap: 5
SIMPLE SOLUTION: I was about to follow Casey's instructions when a simpler solution
popped into my mind. I removed the DYLD_LIBRARY_PATH environment
variable from my ~/.bashrc and replaced it with an alias:
alias sqlplus="DYLD_LIBRARY_PATH=/Applications/instantclient_11_2 sqlplus"
After killing the OS X Terminal and restarting, and verifying that the
environment variable was gone and alias present, both "brew doctor" and
"sqlplus" were happy.
DISCLAIMER: My alias only addresses sqlplus usage. If you are using more Instant Client functionality, you may need to use Casey's solution or bluebinary's solution. I can't vouch for either Casey's solution or bluebinary's solution, but both approaches seem reasonable.