CocoaPods Errors on Project Build

| | August 7, 2015

I’m unable to build a project that uses CocoaPods. I get the following errors:

diff: /../Podfile.lock: No such file or directory
diff: Manifest.lock: No such file or directory error: 
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.`

$ pod install seems to work fine and adds a Pods Project to my Workspace. I’ve tried $ pod update but this doesn’t help.

It seems that PODS_ROOT is not being set.

Podfile:

platform :ios, '6.0'

workspace 'Example.xcworkspace'
xcodeproj 'example/Example.xcodeproj' 

pod 'TestFlightSDK', '~> 1.3.0-beta.5'
pod 'TestFlightLogger', '~> 0.0.2'
pod 'CocoaLumberjack', '~> 1.6.2'
pod 'Reachability', '~> 3.1.0'
pod 'SBJson', '~> 3.2'
pod 'MKMapViewZoom', '~> 1.0.0'

16 Responses to “CocoaPods Errors on Project Build”

  1. Jayprakash Dubey on November 30, -0001 @ 12:00 AM

    This issue got it solved.

    1. Select Target of your Project
    2. Select Build Settings
    3. Open User-Defined drop-down list
    4. Change value of key PODS_ROOT to ${SRCROOT}/Pods

    Screenshot for above steps

  2. I had the same problem recently. I have tried every possible advice, nothing except this plugin has worked for me:

    https://github.com/kylef/cocoapods-deintegrate

    After the cleaning up of the current cocoapods integration, what’s left to be deleted are Podfile, Podfile.lock and the .xcworkspace. Then just install all over again.

    I hope I will help someone with this.


    1. open .xcodeproj file in sublime text
    2. remove these two lines, if you have clean pods folders, i mean if you got the errors above after you removed pods folder
  3. Vladimír Slavík on November 30, -0001 @ 12:00 AM

    I have created multiple targets before I ever used pods. Later when I started to compile the other targets I had to add link_with with the list of targets in my Podfile.

  4. update: a podfile.lock is necessary and should not be ignored by version control, it keeps track of the versions of libraries installed at a certain pod install. (It’s similar to gemfile.lock and composer.lock for rails and php dependency management, respectively). To learn more please read the docs. Credit goes to cbowns.


    In my case, what I did was that I was doing some house cleaning for my project (ie branching out the integration tests as a git submodule.. removing duplicate files etc).. and pushed the final result to a git remote repo.. all the clients who cloned my repo suffered from the above error. Inspired by Hlung’s comment above, I realized that there were some dangling pod scripts that were attempting to run against some non-existent files. So I went to my target build phase, and deleted all the remaining phases that had anything to do with cocoa pods (and Hlung’s comment he suggests deleting Copy Pods Manifest.lock and copy pod resources.. mine were named different maybe b/c I’m using Xcode 5.. the point being is to delete those dangling build phases)..

  5. Go to the target’s Build Settings and make sure the value of PODS_ROOT equals ${SRCROOT}/Pods in “User-Defined” section.

    enter image description here

  6. I have a similar issue this is what worked:

    1. In Xcode:
      • Clean
      • Delete Derived Data in Xcode/Window/Organizer/Project/Your Project
      • Pod directory (it contains config files, delete files not just references!)
      • Removed all references to the pod config files for every target in Project/Configurations (debug/release)
      • Removed “Targets/Build Phases/Copy Pods Resources” from all Targets
      • Removed “Targets/Build Settings/User-Defined/PODS_ROOT” from all Targets
    2. Quit Xcode
    3. In your project directory:
      • rm -rf Pods
      • rm -rf YourProject.xcworkspace
      • rm -rf Podfile.lock
    4. pod install
    5. Open YourProject.xcworkspace in Xcode
  7. Simply resolved by doing the following:

    • (sudo) gem install cocoapods

    • pod install

    • clean and build

    it seems the problem was caused by one of our team members having a more recent cocoapods gem installation.

  8. Had the same issue saying
    /Pods/Pods-resources.sh: No such file or directory
    even after files etc related to pods were removed.

    Got rid of it by going to target->Build phases and then removing the build phase “Copy Pod Resources”.

  9. TLDR: This is most likely a bug with Xcode and closing and reopening the project is usually the simplest fix. Assuming everything else is configured properly.


    I occasionally get the same error when deleting the Pods directory and then running pod install.

    Everything appears correct in the project info:

    enter image description here

    However, when I go to the target’s User-Defined Build Settings, the PODS_ROOT entry is either entirely missing or is empty for one or more configurations. Which causes the following error on build:

    enter image description here

    The simplest fix is to close the project in Xcode and reopen it.

    If you go to the target’s Build Settings and filter on All, you will now see the PODS_ROOT entry with no errors:

    enter image description here

    It should now build with no errors.


    Note: Even Cocoa Pods’ official AFNetworking iOS Example has this problem, which leads me to believe that it is a bug with Xcode.

    An alternative fix is to manually change the configuration to None, then back to its original value:

    enter image description here

  10. I had this issue.

    The way I fixed it was by completely deleting the Pod implementing and re-implementing it. Make sure to delete “Copy Pods Resources” and “Check Pods Manifest.lock” from “Build Phases” on all targets as stated here: How to remove CocoaPods from a project?

  11. In my case the problem was in the wrong way. solution here http://guides.cocoapods.org/using/troubleshooting.html

    If something doesn’t seem to work, first of all ensure that you are
    not completely overriding any options set from the Pods.xcconfig file
    in your project’s build settings. To add values to options from your
    project’s build settings, prepend the value list with $(inherited).

  12. Vladimir Stazhilov on November 30, -0001 @ 12:00 AM

    It wasn’t very intuitive. I went to the base project settings and then I hardcoded paths to my pod.lock and pod.manifest under Check Pods Manifest.lock, because they stayed in different folders in fact, so my paths looked like this:

    diff "/Users/admin/Desktop/Experimental/projectfolder/Podfile.lock" "/Users/admin/Desktop/Experimental/projectfolder/Pods/Manifest.lock" > /dev/null
    if [[ $? != 0 ]] ; then
        cat << EOM
    error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
    EOM
        exit 1
    fi
    
  13. I got rid of the same problem by doing following steps:

    • Xcode->Product->Clean Build Folder (hold alt key on Product to see it)
    • Open Xcode->Window->Organizer and select Projects tab. Then find your project and delete derived data of the project.
  14. So it seems that CocoaPods didn’t set the Configurations for my Project. They need to be based on the Pods.xcconfig which is found in the Pods/Target Support Files/Pods. To get this to work I had to do the following:

    1. Drag this file into my Xcode Project in Xcode, choosing not to copy.
    2. Now there is a reference in our project, we can set the configurations:
      enter image description here

    I then had another build error which may or may not have been related. The path to the shell script defined in the Copy Pods Resources was incorrect.

    "${SRCROOT}/Pods/Pods-resources.sh"
    

    Resolved incorrectly. It seemed that SRCROOT was adding an extra dir that didn’t exist into the path. So I hard coded the path to the Project folder.

    This allowed me to build.

    Why is it that so many things that are supposed to save you time end up eating it up?

    Note: Please see @abood’s answer for explanation.

  15. I had a similar problem when I did major changes to my Podfile. My solution was to remove the workspace file and run pod install again:

    rm -rf MyProject.xcworkspace
    pod install
    

Leave a Reply