You may be able to permanently change the reference by using install_name_tool
included with OS X Xcode command line tools.
install_name_tool -change old-lib-path new-lib-path path-to.so
However, if new-path
is longer than the original old-path
, there may not be room in the field in the bundle file (.so) to do so. The man
page for install_name_tool
cautions:
For this tool to work when the install names or rpaths are larger the binary should be built with the ld(1) -headerpad_max_install_names option.
Also, there is no guarantee that the new Python you wish to use was built in a way that is compatible with the old shared library expected by the .so you are trying to modify. There may be differences in universal CPU architectures, OS X deployment targets, and Python build options (for example, UCS-2 vs UCS-4) that may preclude success. You should make a copy of the .so before attempting to modify it.