How can I change the filename of a shared library after building a program that depends on it?

We can use patchelf: patchelf –replace-needed liboriginal.so.1 libreplacement.so.1 my-program We can also remove a dependency: patchelf –remove-needed libfoo.so.1 my-program Add a dependency: patchelf –add-needed libfoo.so.1 my-program Or change the path where to search for the libraries (rpath): patchelf –set-rpath /path/to/lib:/other/path my-program

dyld: Library not loaded … Reason: Image not found

Find all the boost libraries (where exefile is the name of your executable): $ otool -L exefile exefile: @executable_path/libboost_something.dylib (compatibility version 0.7.0, current version 0.7.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0) and for each libboost_xxx.dylib, do: $ install_name_tool -change @executable_path/libboost_something.dylib /opt/local/lib/libboost_something.dylib exefile and finally verify using otool … Read more