How to properly use third-party dylib in a notarized app

Hello,

I would like to know the most appropriate and correct way to run a C program that relies on a third-party dylib that has already been notarized. I am developing a desktop app that will be published in the Mac App Store. However, when I try to run the C program as I did before notarization, I encounter the following error:

dyld[13471]: Library not loaded: third-party.dylib Referenced from: <962ACED9-BC9C-3AF4-B350-EF0D8DC75C99> /path/to/c/program Reason: tried: ‘third-party.dylib' (relative path not allowed in hardened program), '/System/Volumes/Preboot/Cryptexes/OSthird-party.dylib' (no such file), 'third-party.dylib' (relative path not allowed in hardened program), '/usr/lib/third-party.dylib' (no such file, not in dyld cache).

What are the alternatives for running the C program?

Replies

All the code in your product should be signed by you. This is the right thing to do when distributing your app independently [1] and absolutely required by the Mac App Store [2]. In your case, I recommend that:

  1. Embed this third-party library and helper tool in your bundle according to the rules in Placing Content in a Bundle.

  2. Make sure both are signed by you as part of your build process.

I have two other resources that might be of interest:

Finally, remember that the tool will be run in a sandbox that it inherits from your app, so you have to make sure it works in that environment.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] After all, you’re responsible for putting that code on the user’s machine. If that code induces nasal demons, saying “Oh, but it’s some other developer’s code!” is unlikely to be well received by your users.

[2] That’s because the Mac App Store re-signs your code during the distribution process.