otool -L
dependencies for a binary:
$ otool -L libeditorlib.dylib
libeditorlib.dylib:
libeditorlib.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@rpath/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libnlopt.0.dylib (compatibility version 0.0.0, current version 0.10.0)
/usr/local/opt/openvdb/lib/libopenvdb.8.0.dylib (compatibility version 8.0.0, current version 8.0.1)
/usr/local/opt/ilmbase/lib/libHalf-2_5.25.dylib (compatibility version 25.0.0, current version 25.0.4)
/usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 15.0.0, current version 15.1.0)
/usr/local/opt/mpfr/lib/libmpfr.6.dylib (compatibility version 8.0.0, current version 8.0.0)
@rpath/QtQuickControls2.framework/Versions/5/QtQuickControls2 (compatibility version 5.12.0, current version 5.12.4)
Some dependencies are inside /usr/local/opt/
. I want to change them so that the @rpath/
is searched for them instead.
I would have to change them one-by-one like this:
$ install_name_tool -change /usr/local/opt/openvdb/lib/libopenvdb.8.0.dylib @rpath/libopenvdb.8.0.dylib libeditorlib.dylib
Is there a convenient way to change all /user/local/opt/...
to @rpath
?
I had to change the install_name for each library one-by-one. I wish I could find an easier way to do so:
install_name_tool -add_rpath @executable_path/../Frameworks/. libeditorlib.dylib
install_name_tool -change /usr/local/opt/openvdb/lib/libopenvdb.8.0.dylib @rpath/libopenvdb.8.0.dylib libeditorlib.dylib
install_name_tool -change /usr/local/opt/ilmbase/lib/libHalf-2_5.25.dylib @rpath/libHalf-2_5.25.dylib libeditorlib.dylib
install_name_tool -change /usr/local/opt/gmp/lib/libgmp.10.dylib @rpath/libgmp.10.dylib libeditorlib.dylib
install_name_tool -change /usr/local/opt/mpfr/lib/libmpfr.6.dylib @rpath/libmpfr.6.dylib libeditorlib.dylib