Apple Mach-O-Linker Error CocoaPods

15,498

Solution 1

This error usually occurs either when you don't have the correct frameworks (might be missing one) or when you don't have the right thing in linker flags.

Go to the main page for the app (on the navigation thing on the left click on your apps name or the top section) -> Build Settings and under Linker Flags, make sure there is nothing in your Other Linker Flags. I had this same error when I had -ObjC in my other Linker Flags.

You might also want to try adding -lPods to your Other Linker Flags or adding the CoreGraphics framework if you don't already have it.

Good luck

Solution 2

Open workspace file, not project file. Cocoapods automatically creates a xcworkspace file on the same directory as xcproject file.

Solution 3

Xcode started displaying this message and I tried pretty much everything to solve it. What finally did the trick for me was deleting all content from ~/Library/Developer/Xcode/DerivedData/

Share:
15,498
KFDoom
Author by

KFDoom

Contrary to popular belief, bandz do not make her dance.

Updated on June 15, 2022

Comments

  • KFDoom
    KFDoom almost 2 years

    I've been trying to get my app up and running. From what I could tell the app was missing Cocoapods as a dependency. So. I installed and added Cocoapods. But I'm still getting the same error for whatever reason. I'm an inexperienced developer trying to teach himself I must add.

    Ld /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator/Umbrella.app/Umbrella normal i386 cd "/Users/bfarag/Desktop/The Nerdery/BRAVO.iOS.CodeChallenge" export IPHONEOS_DEPLOYMENT_TARGET=7.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator -F/Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator -filelist /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Intermediates/Umbrella.build/Debug-iphonesimulator/Umbrella.build/Objects-normal/i386/Umbrella.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-Umbrella-AFNetworking -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework Accelerate -framework UIKit -framework Foundation -framework CoreGraphics -lPods -lPods-Umbrella -Xlinker -dependency_info -Xlinker /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Intermediates/Umbrella.build/Debug-iphonesimulator/Umbrella.build/Objects-normal/i386/Umbrella_dependency_info.dat -o /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator/Umbrella.app/Umbrella

    ld: library not found for -lPods
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Linker Flags

  • KFDoom
    KFDoom over 9 years
    Yeah that's how I open it.
  • dadalar
    dadalar over 9 years
    Maybe project file is manually edited and broken. Can you try using pod update command again, so it can fix this kind of reference problems?
  • fabian
    fabian about 9 years
    Are my linker flags okay (check the new image at the top of my post)
  • fith
    fith almost 8 years
    Same! Thank you! So many unsolved tickets with this problem; glad I finally found this one.
  • Davide Callegari
    Davide Callegari almost 7 years
    I believe that @dadalar answer is more correct than this one, it worked for me.
  • willbattel
    willbattel over 6 years
    Thanks! I deleted $(inherited) from my Other Linker Flags and it worked. Wish I had found this while I still had my hair.
  • Pranav Kasetti
    Pranav Kasetti over 3 years
    Classic iOS dev.