fatal error: malformed or corrupted AST file - Xcode

I get this error when building my app in the latest version of Xcode:

fatal error: malformed or corrupted AST file: 'Unable to load module "/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP/Darwin.pcm": file not found' note: after modifying system headers, please delete the module cache at '/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP' 1 error generated.

When I navigate to:

/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache

I can see that the directory 'XYZYIE6ZV0OP' doesn't exist.

Does anybody know how I can resolve this? I cannot delete anything at the directory as suggested in the 2nd part of the error message as that directory doesn't exist!


Had same problem. Clearing derived data folder solved the issue for me. In Xcode, go to Window->Organizer->Projects, select your project, and press the "Delete..." button next to "Derived data".

If this doesn't work, you can try to do a Product->Clean (Cmd+Shift+k).


Press Command + shift + k or clean the project and then run project...


In Xcode select Product-->Clean problem will be solved


By default Library folder is hidden in Mac. Best way to navigate to that folder is :

  1. Open Finder
  2. Select Go from menu -> Select "Go to folder"
  3. Type : /Users/"your user name"/Library/Developer/xcode

This will open direct xcode folder inside hidden library folder.

  1. Select "DerivedData" folder
  2. Command + A, select all and delete them.
  3. Open Simulator and "Reset Content and Settings".

Now run XCode again, all will fix.