Xcode: "is out of date and needs to be rebuilt"

When I do a "Clean Build Folder" I always get:

<unknown>:0: error: module file '…/…/….pcm' is out of date and needs to be rebuilt: signature mismatch


If Xcode knows that it is out of date, why doesn't it recompile? This just doesn't make any sense.


Roddi


Posted on Sep 28, 2022 8:41 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 29, 2022 9:45 AM

I’ve used a local variation of this script when Xcode has gotten very tangled:


https://gist.github.com/maciekish/66b6deaa7bc979d0a16c50784e16d697


#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app


I haven’t met the clang paths in recent years, and there’s a build data path that might need to be targeted in the same place as that com.apple.dt.Xcode cache path.


No warranties, have solid backups beforehand, YMMV, etc.

Similar questions

3 replies
Question marked as Top-ranking reply

Sep 29, 2022 9:45 AM in response to roddi48

I’ve used a local variation of this script when Xcode has gotten very tangled:


https://gist.github.com/maciekish/66b6deaa7bc979d0a16c50784e16d697


#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app


I haven’t met the clang paths in recent years, and there’s a build data path that might need to be targeted in the same place as that com.apple.dt.Xcode cache path.


No warranties, have solid backups beforehand, YMMV, etc.

Sep 29, 2022 1:02 AM in response to MrHoffman

Yes, Monterey and Xcode 13.4.1. We still use 13.4.1 because we wait Xcode 14 to stabilise well enough to install it into our CI pipeline.


Apple has this tendency to create more problems in Xcode than fixing old ones, especially in fresh major versions of it. So we tend to be pretty conservative with updating.


The cleaning and building is done by Xcode itself. The project has a (probably unhealthy) mix of remote swift packages, local swift packages and cocoa pods. Also still 20% of Objc code left in the project (not counting external dependencies).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Xcode: "is out of date and needs to be rebuilt"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.