OS X Framework Library not loaded: 'Image not found' – Dev

The best answers to the question “OS X Framework Library not loaded: 'Image not found'” in the category Dev.


I am trying to create a basic OS X Framework, right now I just have a test framework created: TestMacFramework.framework and I’m trying to import it into a brand new OS X Application project.

I have built the .framework file and imported it into the new project, The framework appears to link okay, and I can reference the public header file I added to the framework build phases section.

However, when I try to run the container Application I get the following Error:

dyld: Library not loaded: /Library/Frameworks/TestMacFramework.framework/Versions/A/TestMacFramework
  Referenced from: /Users/samharman/Library/Developer/Xcode/DerivedData/TestMacContainer-dzabuelobzfknafuhmgooqhqrgzl/Build/Products/Debug/TestMacContainer.app/Contents/MacOS/TestMacContainer
  Reason: image not found

After a bit of googling I realised I needed to add a Copy Files section to my container application build phases, so I have done this and set it up like so…

enter image description here

However, I am still getting the runtime error. I’m obviously doing something wrong here, but the Apple developer library resource for this references Xcode 2, so isn’t very helpful!

What have I missed?


I can see in the build log that my TestMacFramework.framework is being copied into the .app contents/frameworks directory, but it isn’t being installed to the Library/Frameworks directory on the HD

enter image description here


The build links correctly if I manually copy the TestMacFramework.framework into the Library/Frameworks directory


So I managed to get it working, it’s quite simple when you have the right instructions. What I was looking for was a ‘private’ framework which lives in the App bundle rather than being written to the system library folder.

Building The Framework

  1. Add a target to create a Cocoa Framework
  2. Within that targets ‘Build Settings’ configure the ‘Installation Directory’ to ‘@executable_path/../Frameworks’
  3. Build library, and access the .framework from the archive or products directory

Including The Framework

  1. Drag the created .framework file into the Xcode Project, be sure to tick ‘Copy Files to Directory’
  2. In the containing applications target, add a new ‘Copy File Build Phase’
  3. Set the ‘Destination’ to ‘Frameworks’
  4. Drag in the created .framework


[Xcode 11+]

The only thing to do is to add the framework to the General->Frameworks, Libraries And Embedded Content section in the General tab of your app target.

Make sure you select the ‘Embed & Sign’ option.

enter image description here

[Xcode v6 -> Xcode v10]

The only thing to do is to add the framework to the Embedded binaries section in the General tab of your app target.

Screenshot from Xcode


The options above where not possible for me to include.
I solved it by specifying the Runpath Search Path

This is on the ‘Build Settings‘ tab.
In the ‘Linking‘ section.
Change ‘Runpath Search Paths‘ into $(inherited) @executable_path/Frameworks


It was quite simple for me, i just added my framework to my embedded binaries under app targets