31

I put another project inside my main project, this one called OAuthSwift and it contained a framework. When I tried to build it, I got this error:

<unknown>:0: error: invalid virtual filesystem overlay file '/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Intermediates/OAuthSwift.build/Debug/OAuthSwiftOSX.build/unextended-module-overlay.yaml'

<unknown>:0: error: clang importer creation failed

After some research, I tried everything all the people said - I opened the file called all-product-headers.yaml and I expected it to contain this (what the website said):

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

but instead it contained this:

{
  'version': 0,
  'case-sensitive': 'false',
  'roots': [
    {
      'type': 'directory',
      'name': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Products/Debug/OAuthSwiftOSX.framework/Headers",
      'contents': [
        {
          'type': 'file',
          'name': "OAuthSwiftOSX-Swift.h",
          'external-contents': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Products/Debug/OAuthSwiftOSX.framework/Versions/A/Headers/OAuthSwiftOSX-Swift.h"
        },
        {
          'type': 'file',
          'name': "OAuthSwiftOSX.h",
          'external-contents': "/Users/gabrieljones/Desktop/Coding/Xcode/Paul's Console/OAuthSwift-master-11/OAuthSwiftOSX/OAuthSwiftOSX.h"
        }
      ]
    },
    {
      'type': 'directory',
      'name': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Products/Debug/OAuthSwiftOSX.framework/Modules",
      'contents': [
        {
          'type': 'file',
          'name': "module.modulemap",
          'external-contents': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Intermediates/OAuthSwift.build/Debug/OAuthSwiftOSX.build/module.modulemap"
        }
      ]
    }
  ]
}

Yes, I changed it to the version I was supposed to like this:

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

And then I locked it, but I got the unable to write to file error as WELL as the invalid virtual filesystem overlay file error. Can anyone help?

2
  • I'm experiencing the same issue. Did you find any solution?Tks.
    – nanospeck
    Oct 5, 2015 at 15:53
  • Try increasing the build number in Info.plist.
    – gfly
    Jan 28, 2019 at 9:13

8 Answers 8

39

Encountered this issue randomly while re-running my app after making changes on Xcode 8.0. I tried Product > Clean, and even deleted the build folder cmd + option + shift + k and deleted the derived data folder entirely, but that didn't end up working. Still got the same error. Restarting Xcode is what ended up working for me.

3
  • 2
    Same here. Rebooting Xcode resolved this for me just now as well. Oct 24, 2016 at 8:37
  • 2
    Yup... I was about to add an answer saying the same: Just restart Xcode.
    – Dan1one
    Nov 17, 2016 at 23:17
  • If after Clean and deleting Derived Data you still can't build, close and reopen Xcode. It worked for me.
    – nodebase
    Dec 16, 2016 at 17:11
27

Hey I got a feeling about this: I think this might just be a case where Xcode is broken when you have non-alphanumeric characters in your target name. My project also had and apostrophe in the target name

Yours: /Xcode/DerivedData/Paul's_Console

Mine: /Xcode/DerivedData/Lord's_Prayer

Can you try changing your target name. I got an hint about thought from here.

6
  • Thanks, I'll have a look at that.
    – brimstone
    Oct 5, 2015 at 20:36
  • 2
    That is correct. Remove the apostrophes. Also, It doesn't seem to like white space in the Target name either.
    – bowditch
    Feb 11, 2016 at 13:02
  • 2
    I'm astonished every time as to how much time and headache SO saves me, thanks for the hint! Has anyone filed a bug report?
    – Finn Gaida
    May 27, 2016 at 9:52
  • 1
    @FinnGaida Yeah, I did last October. Still no response...but it's filed.
    – brimstone
    Jun 2, 2016 at 1:52
  • After renaming your target, remember to change the Display Name back to what you wanted it to look like to begin with. BTW, mine was Let's Talk Sep 26, 2016 at 19:42
4

It seems that if any item in the path contains certain non-alphanumeric characters, then you will encounter this issue.

I encountered this problem, because the name of my Xcode scheme contained an apostrophe. My target's name was totally free of non-alphanumeric characters. Removing the apostrophe allowed me to build.

Thank you nanospeck for giving me the clue that lead to this discovery.

2
  • 1
    I've submitted a bug report to Apple. Thanks for the help.
    – brimstone
    Dec 23, 2015 at 6:36
  • Confirming that it is still not fixed on 10/25/2016
    – J. Doe
    Oct 25, 2016 at 18:50
3

Faced the same problem while archiving my project but you can get rid of this issue by deleting the DerivedData of the app.

Following are steps to delete DerivedData:

1) Select the Organizer from window menu of the xcode.

2) Now you need to select the builds one by one.

3) You can delete the selected build by pressing delete button from the keyboard.

This will clear up all the derivedData for the project and now you are ready to go ahead. Have fun guys :)

1
  • 2
    You can also: 1) Press "⌘+," to get to preferences -> locations<a tab/icon>, and then 2) click the convenient arrow near the path of the derived data to have Xcode open up finder to the folder. 3) Get your flamethrower and go nuts. 4) Profit!
    – AmitaiB
    Nov 10, 2016 at 0:14
3

Not only deleting DerivedData works, you need to delete ModuleCache folder as well and it worked for me.

1
  • where is the ModuleCache?
    – GameDev
    Feb 21, 2022 at 19:54
1

After Clean and Clean build folder... let the Xcode finish the Indexing, then build.

1

So after running into this issue myself I found that the cause is the use of ' in my project name. So I renamed my project following the steps outlined by Luke and Dan.

But after cleaning and building I got a linker error. The problem was solved by:

  • going clicking on the project in the "Project navigator" on the left then going selecting "Build Phases"
  • In the "Link Binary with Libraries" remove the library with the old name
  • then clean and build (Command + Shift + K to clean, Command + B to build).
-1

It in my case error was caused by enum nested in class

changing

class A {
    private enum E {
        ...
    }
    ...
}

into

fileprivate enum E {
    ...
}

class A {
    ...
}

solved problem

1
  • It can not be valid solution.
    – Vinod
    Oct 23 at 14:17

Your Answer

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

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