Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

Xcodeinfo.plistPch

Xcode Problem Overview


I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device: >file 'project.pch' has been modified since the precompiled header was built

Something to note is that the app runs fine in the simulator.


Edit: Now I am getting this error instead of the other one: >No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)

No such file or directory error

How to regenerate the info.plist file?

Xcode Solutions


Solution 1 - Xcode

You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K

Note: this means the clean the build folder (by pressing Option + Product -> clean folder)

Solution 2 - Xcode

  1. Close your project or workspace.
  2. In Finder: ⇧shift+⌘cmd+G
  3. Paste: ~/Library/Developer/Xcode/DerivedData/
  4. Delete the ModuleCache folder and empty trash.
  5. Open up your project.
  6. Clean: ⇧shift+⌘cmd+K
  7. Build: ⌘cmd+B

Solution 3 - Xcode

In my case the error message had a small hint:

> note: after modifying system headers, please delete the module cache > at > '~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'

I tried and it worked.

Solution 4 - Xcode

Simply touching the project's pch file solved this issue it for me :

touch Test.pch

Solution 5 - Xcode

  • Product -> Clean
  • Product + Option -> Clean Build Folder
  • Close Project or Workspace
  • Clean 'ModuleCache' path in Finder.

Worked for me in Xcode6 GM and iOS 8.0.

Solution 6 - Xcode

When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.

The following maybe tried in order to fix this issue

  • In, Project -> Build Settings, change Precompile Prefix Header to NO

    OR

  • Run rm -rf ~/Library/Developer/Xcode/DerivedData and Clean Build

Solution 7 - Xcode

I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).

What worked for me is to use this as command line build command:

xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build

Before this, I've tried:

  • Clean the project in Xcode GUI.
  • Delete the offending pch file.
  • Delete the offending pch file's parent folder.
  • Delete the DerivedData project folder.

None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.

Note that the problem didn't happen to me when using Xcode GUI.

Solution 8 - Xcode

I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there

Solution 9 - Xcode

Just Click Product from the menu and select Clean

> Product>Clean

Worked fine for me.

Solution 10 - Xcode

I got the same problem. My error said like I need to delete the cache in the below locaition,

> Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W

3FGETKFCU0N0W was a folder, when I deleted it and then clean build the project. Then the error disappears.

Solution 11 - Xcode

rm -rf ~/Library/Developer/Xcode/DerivedData/

Solution 12 - Xcode

If you use AppCode you can try remove content form: /Users/[Username]/Library/Caches/appCode30/DerivedData/

Worked for me :)

Solution 13 - Xcode

For me, this problem is only occurring in Xcode 6 beta version, So I switch back to Xcode 5, and now problem is solved.

I tried all the steps suggested by all users here, but no one worked for me.

So, if you have both versions of Xcode and have issue only in Xcode 6 beta, then switch to Xcode 5 and clean the project, problem will be solved.

Solution 14 - Xcode

Also, just open terminal, and delete the .pcm file that has been generated (Xcode 6 onwards)

rm <path-to-pcm-file>

Solution 15 - Xcode

If you get this when switching between git branches, try adding this post-checkout hook which will clean your project every time you change branch.

!/bin/sh
xcodebuild clean -configuration Debug

Save as .git/hooks/post-checkout relative to your project root and don't forget chmod +x .git/hooks/post-checkout

Solution 16 - Xcode

I tried these one by one but failed to build and run my project. So I changed Precompile Prefix Header to NO as mentioned by @Abhilash Gopal, then I reset the simulator,deleted the derived data, removed the corresponding .pcm file(In my case it was the UIImage.h from UIKit framework, so removed the UIKit.pcm).Then I cleaned the project and only then I was able to build it successfully. In earlier versions of Xcode these files were locked basically and were not allowed to edit. But its not the case now. Hope this helps someone who face the same situation.

Solution 17 - Xcode

The only solution there worked for me was running the following command:

sudo rm -R /var/folders/

But that gave me a lot of troubles in OS X.

I thought because /var/folders/ is for temporary files it should be okay to just empty anything in it. But I was wrong see the following post: link

And the problem you described occurred every-time I tried to build my Xcode project - I'm building it from the CLI though Jenkins.

Which means I couldn't run the rm command every-time. So I found some inspirations and wrote the following ruby script which solved my problem:

#!/usr/bin/env ruby

require 'fileutils'

cache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf(cache)

I hope it would be helpful to someone.

Solution 18 - Xcode

Deleting project.xcworkspace did a trick for me.

project.xcworkspace is a directory which describes schema of current Xcode workspace state. Each time Xcode is launched it will regenerate project.xcworkspace if not exist already.

In order to delete project.xcworkspace:

  • Right click on your project file yourProject.xcodeproj
  • From drop-down menu choose Show Package Content
  • Purge xcworkspace file

Solution 19 - Xcode

If you are building on command line using xcodebuild remove '-parallelizeTargets' option passed to the command. That fixed the issue for me

Solution 20 - Xcode

After going through a lot of answers and helpful suggestions, I found out the solution to be: Uninstall Xcode 6 and reinstall it through the available dmg file and then install all the components for Xcode.

Product + Option -> Clean Build Folder, Clean Build Project, Deleting Module Cache files and Derived data files, using touch .pch, deleting pcm file, using command line to remove var/folders (Surprisingly, all of this did not help in my case)

Was stuck at it for more than 3 hours before finding the solution. Hope this helps someone.

Thanks.

Solution 21 - Xcode

Just open terminal and fire below command:

rm /Users/pratik/Library/Developer/Xcode/DerivedData/ModuleCache/LKL48GNAN6S7/UIKit-2X95M2Q1NPNPL.pcm

give your file path which return .pcm error. and then Clean Project and Run...Enjoy!!!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1542348View Question on Stackoverflow
Solution 1 - XcodeHexAndBugsView Answer on Stackoverflow
Solution 2 - XcodeemotalityView Answer on Stackoverflow
Solution 3 - XcodeCedricSoubrieView Answer on Stackoverflow
Solution 4 - XcodeıɾuǝʞView Answer on Stackoverflow
Solution 5 - XcodeJorge SVView Answer on Stackoverflow
Solution 6 - XcodeAbhilash GopalView Answer on Stackoverflow
Solution 7 - XcodekakyoView Answer on Stackoverflow
Solution 8 - Xcode0oneoView Answer on Stackoverflow
Solution 9 - XcodeM_R_KView Answer on Stackoverflow
Solution 10 - XcodeEaswaramoorthy KView Answer on Stackoverflow
Solution 11 - XcodeRudolf AdamkovičView Answer on Stackoverflow
Solution 12 - XcodelembrykosView Answer on Stackoverflow
Solution 13 - XcodeNitesh BoradView Answer on Stackoverflow
Solution 14 - XcodeAbhilash GopalView Answer on Stackoverflow
Solution 15 - XcodeMaciej SwicView Answer on Stackoverflow
Solution 16 - XcodeMeeraView Answer on Stackoverflow
Solution 17 - XcodemartinmoseView Answer on Stackoverflow
Solution 18 - XcodeDeloreanView Answer on Stackoverflow
Solution 19 - XcodedevView Answer on Stackoverflow
Solution 20 - XcodeSomView Answer on Stackoverflow
Solution 21 - XcodePratik PatelView Answer on Stackoverflow