multipart-message nevyn bengtsson's blog

featured articles 🦄, about, archive, tags

Use @rpath instead of @loader_path or @executable_path in .frameworks

Update: mikeash has written an excellent post on install names, including @rpath. Just read his post.

I’ve written a great deal (1, 2) about how to make bundled .frameworks work. My “old” method has been to use @loader_path/../Frameworks/[frameworkName].framework/Versions/A/[frameworkName] in the .framework’s install name, and rewrite the .app’s load paths with install_name_tool if it’s wrong. However, I just found @rpath and it’s much more powerful and much easier to use. I’ll blog it more when I have time, but for now, read the documentation about RPATH and do use it instead of @executable_path or @loader_path, unless you have a good reason.

Using @rpath solves this problem:

Why? Because in the .app you can decide which RUtils.framework should be used by setting “Runpath Search Paths”.

Tagged metadev