Cocoapods: dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire

Created on 20 Jun 2015  ·  28Comments  ·  Source: CocoaPods/CocoaPods

When I try building a cleaned project in XCode 6.3 on OS 10.10.3, I get the following linking error:

dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire Referenced from: /Users/XXX/Library/Developer/Xcode/DerivedData/[project-name]-efvoumxcofsflobbhnbwjlxwelff/Build/Products/Debug/[project-name] Reason: image not found

My Podfile:

platform :osx, '10.10'
use_frameworks!

target 'worth-swift' do
  pod 'Alamofire', '>= 1.2'
  pod 'SwiftyJSON', '>= 2.2'
end

I'm probably missing something, but I thought that after a pod install build configuration is set up. I haven't used Cocoapods with Swift yet though.

Most helpful comment

@kitasuke your project contains a commandline application target, you need to set up your @rpathmanually for that case.

All 28 comments

Hmm, this might be fixed by #3550 but I'm not entirely sure.

@wegry can you try this with the 0.38 beta? $ [sudo] gem install cocoapods --pre

Currently also encountering this problem. We're using the newest beta 0.38.0.beta.2 and have done a new pod install after removing the Pods.lock, the Pods directory and the workspace. Where it used to halt on dyld: Library not loaded: @rpath/Alamofire.framework, it now halts on;

dyld: Library not loaded: @rpath/libswiftCoreAudio.dylib

This is our Podfile:

platform :ios, '8.0'

use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

pod 'Moya'
pod 'ReactiveCocoa', '3.0-beta.6'
pod 'Moya/Reactive'
pod 'RSBarcodes_Swift', '~> 0.0.8'

@gyansantokhi are you using Xcode 7 by any chance?

We're using Xcode 6.4 (non-beta version), it's a clean install with no other Xcode versions on the system. 0.38.0.beta.2 is the only version of cocoapods installed.

The library is referenced from RSBarcode_Swift.framework. Curiously the RSBarcodes_Swift pod doesn't seem to use Core Audio, yet including the framework and importing Core Audio manually makes the build error disappear.

We've tried to load RSBarcodes_Swift as a development pod locally with Core Audio in its podspec, but the error remains in that case. RSBarcodes_Swift did not generate this error in the past, but now persists also after downgrading to cocoapods 0.37.2, removing all pod related files except for the podfile and running pod install.

Maybe this is actually this issue: CocoaPods/cocoapods-packager#48? Could you try setting “LINK FRAMEWORKS AUTOMATICALLY” to NO?

Tried both on the pods and and app xcodeproj files (both YES, both NO and either YES or NO), doesn't make a difference. Also tried setting "EMBEDDED CONTENT CONTAINS SWIFT CODE" to YES without any change.

Same here.

Xcode 6.4
OS X 10.10.4
Swift 1.2
CocoaPods 0.38.0.beta.2 (I tried as well with 0.37.2)

dyld: Library not loaded: @rpath/libswiftAppKit.dylib
  Referenced from: /Users/me/Library/Developer/Xcode/DerivedData/CocoaPodsDemo-dixumdcdivuruzgrzizdesyymjhn/Build/Products/Debug/Alamofire.framework/Versions/A/Alamofire
  Reason: image not found

Podfile

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

platform :osx, '10.10'

target :CocoaPodsDemo do
    pod 'Alamofire'
end

I uploaded my sample project which reproduces the issue hopefully, so please also see it for more detail.

I tried setting LINK FRAMEWORKS AUTOMATICALLY to NO, but it didn't work for me...

What I figured out is that it works fine with same project settings in Objective-C. I guess it could be swift related issue?
I would appreciate if you could tell me something missing in this project.

@kitasuke your project contains a commandline application target, you need to set up your @rpathmanually for that case.

@neonichu Thanks for your quick reply! I'll try setting that.

@neonichu we're experiencing this problem with our project right now. We have an app, that has an embedded framework. There is also a keyboard extension. The extension is dependent on the embedded framework.

Our Podfile looks like this:

inhibit_all_warnings!
platform :ios, '8.0'
use_frameworks!

target 'App' do

pod '...'
# more pods

end

target 'Keyboard' do

end

target 'EmbeddedKit' do

pod 'AFNetworking', '~> 2.0'

end

We're getting the following error when trying to run on a device (seems to work on the simulator).

dyld: Library not loaded: @rpath/AFNetworking.framework/AFNetworking
  Referenced from: /private/var/mobile/Containers/Bundle/Application/AEDFAED0-E0EF-4920-8B92-BC95989B43E1/App.app/Frameworks/EmbeddedKit.framework/EmbeddedKit
  Reason: image not found

I have completely removed Cocoapods multiple times, and made sure the Copy Pod Resources build phase is added.

Any help would be greatly appreciated.

@bensarz please attach a project we can use to debug the issue

+1 on this issue
cocoapods: 0.38.2
Xcode7beta4, ios9,
project has a mix of swift and objC code

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, "9.0"
pod 'AFNetworking', '~> 2.5.4'
pod 'Wit'
pod 'ContactsManager'
pod 'MBProgressHUD'
pod 'HexColors'
pod 'SCSiriWaveformView'

same error on device only... Simulator is fine.

dyld: Library not loaded: @rpath/AFNetworking.framework/AFNetworking
...

(same issue happens for ios 8.4 / xcode 6.4 also )

tried setting EMBEDDED CONTENT CONTAINS SWIFT CODE and LINK FRAMEWORKS AUTOMATICALLY to both YES and NO but same error

So to answer my own question.... i found this resource here:

http://databasefaq.com/index.php/answer/118182/ios-xcode6-cocoapods-dyld-library-not-loaded-with-cocoapods-037-and-xcode-63!

I am copying it over in case it helps anyone else... it helped me.

  1. Deintegrate the cocoapods project (you can install the tool with sudo gem install cocoapods-deintegrate)
  2. Modify your Podfile:

    • You should define your target linking with link_with 'ProjectName'.

    • You should define the target for your pods: target 'ProjectName' do [pods here] end.

    • Make an install with pod install

  3. After doing this, go to XCode and check the following settings:

    • In project settings, under "Configurations" check that in Debug and Release you've got a Configuration set named Pods-ProjectName.[debug|release]

    • In your target, under "Build Phases" you should have three new phases that should be named: Check Pods Manifest, Embed Pods Frameworks and Copy Pods Resources.

    • Make clean, then build, then run on your device.

In my case it was mistake in pod file. =/

Before:

link_with 'MyApp', 'MyAppTests'

target :MyApp do
    pod 'AFNetworking', '~> 2.0', :inhibit_warnings => true
end

target :MyAppTests do
    ...
end

After:

link_with 'MyApp', 'MyAppTests'

pod 'AFNetworking', '~> 2.0', :inhibit_warnings => true

target :MyAppTests do
    ...
end

After moving dependency into root it runs fine now.

@neonichu My app is a command line app as well. Where do we set the rpath to with CocoaPods?

@wegry just as you do it without CocoaPods

@edwardvalentini thanks, that fixed it for me =)

Hi
I got a similar issue. I have a project with two targets. One target is the app it self and the other target is a cocoa touch framework.

I get this error:

dyld: Library not loaded: @rpath/SwiftAddressBook.framework/SwiftAddressBook
  Referenced from: /private/var/mobile/Containers/Bundle/Application/48E58889-78D4-4D71-B8DA-154ADEB98894/Pod Error Framework.app/Frameworks/PodErrorKit.framework/PodErrorKit
  Reason: image not found

And here is my Podfile:

platform :ios, '8.0'
use_frameworks!

target 'Pod Error Framework' do
    pod 'SVProgressHUD'
end

target 'Pod Error FrameworkTests' do

end

target 'PodErrorKit' do
    pod 'SwiftAddressBook'
end

target 'PodErrorKitTests' do

end

If you want to have a look to the project just follow this link: pod-cocoa-touch-framework

It will run on the simulator but not on the device. Here is my stackoverflow post

@katunch this case isn't really supported currently — you would probably be better off making PodErrorKit/Pod Error Framework a development pod itself.

Let's close this issue, since it was originally about a CLI app and this has been answered. Otherwise this will become a grab bag of @rpath issues.

@neonichu @segiddins

I created a Library ( SDK ) using the OSX Command Line Tool and then i was successful creating a CocoaPod but when i use the newly created Pod with my Demo Application i receive this error :

The Pod that i created is named : MyLibrarySwift

When i try to use the Pod within a demo application

dyld: Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/me/Library/Developer/Xcode/DerivedData/demo-fjxrmbahnyufeqbqlkrunoutfupp/Build/Products/Debug/MyLibrary.framework/Versions/A/MyLibrarySwift
Reason: image not found

My Podfile for the ios Demo Application

use_frameworks!
platform :ios, '8.0'
link_with 'demo'
target 'demo' do
source 'https://github.com/CocoaPods/Specs'
pod 'MyLibrarySwift', :git => 'github repo link'
end

@neonichu is using multiple targets with pods a case that is now supported?

@anilkumarbp same issue here on OSX creating a command line tool

For me it was missing:
📦 Embed Pods Frameworks
in my UI tests target.
Fixed now.

@katunch thank you so much. I actually had a typo in my file as well. Working as expected.

Cocoapods 1.0.0
Bitcode enabled.
Dynamic framework and a few app extensions.

@neonichu I have the same issue on OSX creating a command line tool, so how can we solve this problem? I was drop CocoPods, and using Cartfile. but the same error occurs. Wait for ur kind reply!

@LeeY0510 there have been many framework-related improvements to CocoaPods 1.1.0. Can you update to the latest CocoaPods (1.1.1) and file a new issue? Thanks!

Was this page helpful?
0 / 5 - 0 ratings