29

After updating to Xcode 6 beta 3 the compiler keeps crashing with the following error:

/[Long-path-goes-here]/all-product-headers.yaml:4:13: error: Could not find closing ]!
  'roots': [
            ^
fatal error: invalid virtual filesystem overlay file '/[Long-path-goes-here]/all-product-headers.yaml'
1 error generated.

9 Answers 9

40

Solved by doing the following:

  1. Find the /[Long-path-goes-here]/all-product-headers.yaml (Go to Folder... in Finder)
  2. Replace the contents with the code below.
  3. Save and lock the file. (Get info for file, check locked.)

{ 'version': 0, 'case-sensitive': 'false', 'roots': [] }

After this Xcode will complain about not being able to write the file with this error this is expected and doesn't seem to affect the build. Edit: For most people. If it prevents you from running try disabling Defines Module in Build Settings of your Target:

Unable to write to file /Users/user/Library/Developer/Xcode/DerivedData/.. (You don’t have permission to save the file “all-product-headers.yaml” in the folder “Pods.build”.) 

Hat off to the discussion on Apple Developer forums. Also, this is the relevant issue in CocoaPods issue tracker.

6
  • xcode shows this Error: Unable to write to file /Users/user/Library/Developer/Xcode/DerivedData/.. (You don’t have permission to save the file “all-product-headers.yaml” in the folder “Pods.build”.)
    – TomCobo
    Commented Jul 10, 2014 at 11:12
  • That is expected. The build should run anyway. Commented Jul 10, 2014 at 13:19
  • 1
    It was affecting the build for me (I couldn't finish the build because of the error). I just set Define Module in 'Build Setting' to NO (using the response in the Apple developer forum) and it is working now.
    – TomCobo
    Commented Jul 10, 2014 at 14:58
  • 1
    No idea what's going on there. I'm doing Swift stuff so I need everything to define modules and it works for me anyways. Added that fix tho for anyone not on swift. Commented Jul 11, 2014 at 16:13
  • True. I need it as well. After cleaning the project or adding another import to the briging.h file is throughing another senseless error.
    – TomCobo
    Commented Jul 14, 2014 at 10:27
14

Try setting "Defines Module = YES" in your app target. Works for my project.

2
  • 1
    Worked perfectly for me, I just had to set it on the Cocoapods project since I was using it.
    – omartin
    Commented Jul 20, 2014 at 23:04
  • I use cocoapods [cocoapods.org] and got the same error. But after set "Define Modules = YES" in Pods project worked perfectly Commented Aug 5, 2014 at 10:17
11

Clean (command-shift-K), and clean-build-folder (command-alt-shift-K) and build again worked for me.

6

I had this problem because I deleted some old archives and files from my mac to make more space. However running pod install for this project solved it.

3

Perhaps your path to .yaml file contains ' character. It makes the parser confused. Using TextWrangler, you can see your path has different colors (red & black).

That's my case, and moving project to another path (which doesn't contain ') solved my problem.

2

I solved it by delete the current project's DerivedData folder by (Xcode 8):

Xcode > Preferences > Locations tab > Click on the right arrow under DerivedData > inside the folder DerivedData delete the project folder. Better to do hard clean also by Shift+Cmd+Alt+K. And build.

1

Can fix with one shell command:

echo "{\n\t'version': 0,\n\t'case-sensitive': 'false',\n\t'roots': []\n}" > /[Long-path-goes-here]/all-product-headers.yaml

Where the path is copied out of the Xcode error.

See Daniel Schlaug's answer for background info

0

I tried all the answers above/below. None worked.

However, Restarting Xcode did it.

Try that before going into the madness of trying to fix the actual situation of the missing file. All the rest is madness. Heck, If that doesn't fix it. I would even try restarting every time you do one of the strategies listed here. Maybe one of those fix it but Xcode gets stuck until you restart it.

Nothing else to do, Xcode is just too buggy at times.

0

I get this error too frequently, so I've made a simple bash script based on Daniel Schlaug's answer. I've never needed to lock the file. Just copy the file referenced in your error log and use it as the only parameter. Don't forget to chmod +ux before running.

#!/bin/bash

if [ "$#" -eq "0" ]
then
   echo "No arguments supplied"
   exit
fi

rm -rf $1
echo "
{
  'version': 0,
   'case-sensitive': 'false',
   'roots': []
 }" > $1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.