macosinstall-name-tool

Using install_name_tool what's going wrong?


I'm trying to change the install path of a dylib after it has been built. I use otool -L to check what the current path is. And then I do:

$ install_name_tool -change /my/current/path/libmine.dylib \
    /my/new/path/libmine.dylib libmine.dylib

I don't get an error, but nothing changes. If I check the path again the old one is still there. Also the new path is a lot shorter then the old one, so no problem there, and I think the lib is even compiled with extra flag for more filepath space.

Any ideas?


Solution

  • The man page for install_name_tool says that -change is for dependencies. You're trying to change the name of the library itself.

    Having just experimented, I found I couldn't change the name of a dylib that appears inside the dylib itself but I could change the names of other dependencies.

    Having experimented more: install_name_tool -id newname file will do the trick.