Search code examples
xcodemacosdyldsearch-path

Xcode and dylib search path


I have a framework with installation directory @rpath and app with runpath search path @loader_path/../Frameworks which uses this framework.

After building I have My.app and My.framework in Build/Products/Debug directory and I don't copy My.framework into My.app bundle.

If I run My.app from Xcode it runs and loads framework from Build/Products/Debug directory. If I run my app from Finder it can't load the framework as expected.

Does Xcode set runtime search path and how? DYLD_LIBRARY_PATH?


Solution

  • Yes, Xcode sets both DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH to point to your built product directory when it runs your application.