Skip to content

Instantly share code, notes, and snippets.

@jonasbn
Last active January 23, 2017 13:46
Show Gist options
  • Save jonasbn/c93f49c4cccb8088fd56205d29f5af1c to your computer and use it in GitHub Desktop.
Save jonasbn/c93f49c4cccb8088fd56205d29f5af1c to your computer and use it in GitHub Desktop.
script to change the dynamic library paths and ids for oracle instant client executables and libraries
#!/bin/sh
# script to change the dynamic library paths and ids for oracle instant client executables and libraries
# REF: http://blog.caseylucas.com/2013/03/03/oracle-sqlplus-and-instant-client-on-mac-osx-without-dyld_library_path/
# proces all the executable files in this directory
find . -maxdepth 1 -type f \( -perm -1 -o \( -perm -10 -o -perm -100 \) \) -print | while read exe
do
echo "adjusting executable $exe"
baseexe=`basename $exe`
otool -L $exe | awk '/oracle/ {print $1}' | while read lib
do
echo adjusting lib $lib
baselib=`basename $lib`
if [ "$baseexe" = "$baselib" ]
then
echo "changing id to $baselib for $exe"
install_name_tool -id $baselib $exe
else
echo "changing path id for $lib in $exe"
install_name_tool -change $lib @executable_path/$baselib $exe
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment