fatal error: malformed or corrupted AST file - Xcode
Asked Answered
D

20

120

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!

Daggett answered 7/1, 2014 at 23:29 Comment(1)
Product > Clean is good, but for me this helped: #20014735Hybridism
P
336

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).

Pelisse answered 15/1, 2014 at 1:54 Comment(10)
Thanks devgeek. Your tip worked, but I had to do a Product > Clean after as well, for anyone else who has this issue.Rigid
Worked for me as well. Thanks very much! No clean required here though.Numbing
For me I only needed to cleanDoubletongued
Thanks man, this worked. But can you please explain what is all this about_ I like to know why something happens, when it does. And I just had this error when I opened my project the next day, out of the blue.Hertahertberg
Worked for me. Happened when i tried deploying to a different iphone device than the one I always developed on.Wainwright
clean up build folder would resolve the issue as well. (project > press option & select clean build folder)Runt
I suggest that you try a Cld + Shift + K at first, wich is a lot less complicated to doGrecize
how can one search for problem, without cleaning? silly time :)Chalk
Product -> Clean doesn't worked.. But, deleting "Derived data"worked well for me. Thanks a lot...Wellthoughtof
I tried all these steps. even restarting the machine. no luck then I used to use xcodebuild commands its succeeded. My project target was framework.Incorporator
B
37

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

Borchert answered 26/6, 2014 at 8:6 Comment(1)
Pressing the Alt key while navigating to 'Product' will give you 'Clean build folder' - solved for me.Voussoir
P
13

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

Pacifa answered 23/10, 2014 at 1:20 Comment(0)
C
9

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.

Crannog answered 19/8, 2014 at 11:20 Comment(0)
B
3

I had the same issue, solved it by cleaning the project.

Product-> Clean

or press

command+shift+K

Burberry answered 7/5, 2015 at 7:46 Comment(0)
T
2

In my case, I accidentally modified NSURLConnection.h. Xcode complained about cache at path

/var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/5.0.2-5A3005/Xcode/ModuleCache/XWWWZ5ED888F

I finally found the steps to fix it:

  1. Quit Xcode
  2. Delete the upper "5.0.2-5A3005" at /var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005

When Xcode restarted, it regenerated that folder and everything in it.

Tedtedd answered 31/1, 2014 at 1:11 Comment(0)
V
2

I had the same issue ever since installing the latest SDK.

My solution was to delete the derived data and clean the project.

Varia answered 14/10, 2014 at 17:22 Comment(0)
P
1

I got same error on executing xcodebuild command of Xcode6-beta5.app coexisting with Xcode.app (Xcode 5).

In this case I added -derivedDataPath to separate ModuleCache from the one for default Xcode.app.

  xcodebuild -derivedDataPath ./build/Xcode6-beta5/DerivedData ....

This works for me.

Phobe answered 14/8, 2014 at 5:5 Comment(0)
F
1

I tried deleting derived data and Clean project several times and it doesn't work. The file in my warning is an old file I already deleted from Project Navigator and all the Build Settings. But it keeps showing up and gives me this error. The error only occurs on Simulator, but not on device. Which is really really weird. :/

For some reason, I switched branch to some other branch and switch back and it works again. If anyone even know how that could work please tell me :D

Firmin answered 19/9, 2014 at 10:40 Comment(0)
B
1

Simply clean remove the Derived Data and build folders. The problem shall be resolved.

Blastomere answered 23/1, 2015 at 7:24 Comment(0)
N
0

In my case the SSD was broken. You can verify the disk with apples Disk Utility

Negotiable answered 27/2, 2014 at 10:1 Comment(0)
H
0

In my case I had a spaces in my plist file name.

I removed it, and changed Info.plist File key in target Build Settings

Hanser answered 13/8, 2014 at 14:17 Comment(0)
K
0

Refreash Safari browser, scroll down the page and you will see you "Click + button for add build ..." then add actual build, click Save and "Waiting for Review"

Keeper answered 26/9, 2014 at 13:27 Comment(0)
S
0

Cleaning the project and deleting the drive data didn't fix it for me. But what finally fixed it was changing the model of simulator that I used.

So first do a clean, then if you were running it on iPhone 5 simulator, run it on iPhone 5s simulator to fix the issue. basically, run it on any other simulator other than the one you were running.

(Credit to Hlung for his answer, I hope this one is a bit more clear)

Slime answered 26/2, 2015 at 5:13 Comment(0)
N
0

If you have your project scheme set to "Wait for executable to be launched" this error might happen.

In that case, just changed your scheme from Product > Scheme > Edit Scheme...

Natica answered 1/4, 2015 at 2:34 Comment(0)
C
0

In my case, I tried to archive a app in one project within a xcodeworkspace

close Xcode, the open the single target project, and clean an Then, I do archive, it makes an iOS App archive.

I hope I can help someone.

Col answered 3/12, 2015 at 3:3 Comment(0)
C
0

Got this error while trying to build a third-party app for the first time. Adding foundation as a library fixed the issue for me.

Calvillo answered 22/1, 2016 at 22:10 Comment(0)
I
0

I did Clean cached, Delete derived data, Manually delete the Module cache folders which found from the error logs, Restart xcode, Restart machine. But non of them helped me.

But this steps help me to resolve the issues

  • Comment out all the #import line in [Name]-Prefix.pch files.
  • Build, as expected its pointing me to different errors.
  • Revert back the changes I have done in [Name]-Prefix.pch and Build, compilation succeeded.

This solution help me to resolve the issue.

Incorporator answered 11/4, 2017 at 7:1 Comment(0)
I
0

if you can't find your "Derived data"

  1. File -> Workspace settings
  2. Click on the arrow icon next to your path
  3. Remove "Derived data" folder
Intersection answered 12/2, 2020 at 18:48 Comment(0)
D
-6

tried to re-install XCode which didnt resolve the issue, also created a new local user account & get the same error so in the end I gave up & restored to a time machine backup from a few days before... seems to be ok again... for now!

Daggett answered 9/1, 2014 at 20:22 Comment(4)
What solution does this provide to the OP?Carbonous
@Rambatino, well.. no answer but at least hes telling people not to reinstall xcode.Wainwright
@mihai, In fairness, if you never want to experience fatal errors with Xcode, uninstalling will solve that ^^Carbonous
@Rambatino, you're right, but for this issue reinstalling is overkill and doesnt fix the problem so it is a bit helpful of an answer. This answer should have been a comment instead stating, reinstalling XCode doesnt fix it."Wainwright

© 2022 - 2024 — McMap. All rights reserved.