{"id":527,"date":"2010-12-01T11:16:54","date_gmt":"2010-12-01T16:16:54","guid":{"rendered":"http:\/\/www.jaimerios.com\/?p=527"},"modified":"2010-12-01T11:16:54","modified_gmt":"2010-12-01T16:16:54","slug":"changing-library-dependency-paths","status":"publish","type":"post","link":"https:\/\/jaimerios.com\/?p=527","title":{"rendered":"Changing library dependency paths"},"content":{"rendered":"<p>If you want to change what your host application is dependent on, without having to rebuild it, you can use the install_name_tool app for changing this:<\/p>\n<p><code>install_name_tool -change oldreference newreference appname<\/code><\/p>\n<p><code>install_name_tool -change \/usr\/lib\/libItsAllAboutMe.dylib @executable_path\/..\/Frameworks\/libItsAllAboutMe.dylib  MySuperApp<\/code><\/p>\n<p>This is pretty useful for cases where you might have a dynamic library located in a static location, but you want to bundle it with your application instead of having to use PackageMaker to install the library on the users local filesystem.<\/p>\n<p><strong>2016-10-26 Update<\/strong><br \/>\nWhen I wrote this posting, I had not yet worked with @rpath, which is what you should be using in your Xcode project.<\/p>\n<p>There is a good article that illustrates how to do this at <a href=\"http:\/\/www.dribin.org\/dave\/blog\/archives\/2009\/11\/15\/rpath\/\" target=\"_blank\" rel=\"noopener\">dribin.org<\/a><\/p>\n<p>And, if the library you are linking against does not use @rpath like &#8230;<\/p>\n<p><code>$otool -L libSomeWeakLookingLib.dylib<br \/>\nlibSomeWeakLookingLib.dylib:<br \/>\n\t\/Users\/weaklibnightly\/build_bot\/slave\/mac-64-trunk\/weaklibbuild\/bin\/libSomeWeakLookingLib.dylib (compatibility version 0.0.0, current version 0.0.0)<br \/>\n\t\/usr\/lib\/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)<br \/>\n\t\/usr\/lib\/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)<br \/>\n\t\/usr\/lib\/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)<\/code><\/p>\n<p>Then you can change that long path to a @rpath using<br \/>\n<code>$install_name_tool -id \/Users\/weaklibnightly\/build_bot\/slave\/mac-64-trunk\/weaklibbuild\/bin\/libSomeWeakLookingLib.dylib @rpath\/libSomeWeakLookingLib.dylib .\/libSomeWeakLookingLib.dylib <\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to change what your host application is dependent on, without having to rebuild it, you can use the install_name_tool app for changing this: install_name_tool -change oldreference newreference appname install_name_tool -change \/usr\/lib\/libItsAllAboutMe.dylib @executable_path\/..\/Frameworks\/libItsAllAboutMe.dylib MySuperApp This is pretty useful for cases where you might have a dynamic library located in a static location, but &#8230; <a title=\"Changing library dependency paths\" class=\"read-more\" href=\"https:\/\/jaimerios.com\/?p=527\" aria-label=\"Read more about Changing library dependency paths\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[180,249,389],"class_list":["post-527","post","type-post","status-publish","format-standard","hentry","category-coding","tag-dylib","tag-install_name_tool","tag-rpath"],"_links":{"self":[{"href":"https:\/\/jaimerios.com\/index.php?rest_route=\/wp\/v2\/posts\/527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaimerios.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaimerios.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaimerios.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaimerios.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=527"}],"version-history":[{"count":0,"href":"https:\/\/jaimerios.com\/index.php?rest_route=\/wp\/v2\/posts\/527\/revisions"}],"wp:attachment":[{"href":"https:\/\/jaimerios.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaimerios.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaimerios.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}