Pablo Fernandez
Pablo Fernandez

Reputation: 287390

MacOSX screensaver not loading due to Library not loaded: @rpath/libswiftAppKit.dylib

We have a working Mac OS X screensaver as a standalone Xcode project, but we needed to have it as a target in another Xcode project that also contains a related app.

I added a target for a screensaver, copied the code, added to that target, etc, etc. The code is the same one that works in the other screensaver, but on this one, it generates the following error:

2015-03-10 09:43:24.766 System Preferences[32495]: Error loading /Users/pupeno/Library/Screen Savers/Ninja.saver/Contents/MacOS/Ninja:  dlopen(/Users/pupeno/Library/Screen Savers/Ninja.saver/Contents/MacOS/Ninja, 265): Library not loaded: @rpath/libswiftAppKit.dylib
  Referenced from: /Users/pupeno/Library/Screen Savers/Ninja.saver/Contents/MacOS/Ninja
  Reason: image not found
2015-03-10 09:43:24.766 System Preferences[32495]: ScreenSaverModules: can't get principalClass for /Users/pupeno/Library/Screen Savers/Ninja.saver

The library in question is definitely there:

$ ls -w1 Library/Screen\ Savers/Ninja.saver/Contents/Frameworks/
libswiftAppKit.dylib
libswiftCore.dylib
libswiftCoreGraphics.dylib
libswiftDarwin.dylib
libswiftDispatch.dylib
libswiftFoundation.dylib
libswiftObjectiveC.dylib
libswiftQuartzCore.dylib
libswiftSecurity.dylib

Any ideas what might be causing this?

Upvotes: 7

Views: 1730

Answers (2)

Sam Soffes
Sam Soffes

Reputation: 14935

Like Pablo said, you need the following as your Runtime Search Path:

@executable_path/../Frameworks @loader_path/../Frameworks

This should be the default. Make sure it's there though. You also need to set Embedded Content Contains Swift Code to YES if you're using Swift. That took me awhile to figure out.

(Xcode should totally infer this. Oh well. I filed a radar for this awhile.)

Upvotes: 3

Pablo Fernandez
Pablo Fernandez

Reputation: 287390

The problem was that the Runpath Search Path, for some reason, in this new target, was blank. I fixed this problem by adding this:

@executable_path/../Frameworks @loader_path/../Frameworks

to it (which I took from the working screensaver configuration). This is how it looks like:

enter image description here

Upvotes: 9

Related Questions