Xcode says it has no rule to process a file that is in Compile Sources
warning: no rule to process fileShort answer
For each file in the Compile Sources phase Xcode looks up a build rule by file type. This warning means one of those files has a type no rule can compile. Read the path in the warning, then remove the file from Compile Sources. Headers belong in the Headers phase, resources in Copy Bundle Resources, and a real custom type needs its own build rule.
Fix it fast
1Find out which cause you have
Build once and keep only the warning lines. Each one carries the full path of the file, and the folder it sits in often tells you which kind of file it is.
xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep "no rule to process file"2Match what you see, then jump to its fix
- 1
The path in the warning ends in .h or .hpp.A header file is listed in Compile SourcesFix - 2
The path ends in .json, .txt, .md, .plist or a similar extension: a file the app may need to carry, not code.A resource or data file is listed in Compile SourcesFix - 3
The file has to be processed at build time (a template, a schema or a recipe your own tool turns into code or data) and its extension is not one Xcode knows.A genuine source file has a custom type that no build rule coversFix
- 1
What does the error look like?
warning: no rule to process fileno rule to process file '/path/to/File.h' of type <file type> for architecture <arch>
Cause 1 of 3
A header file is listed in Compile Sources
1Check
Open the target, go to Build Phases and expand Compile Sources, which lists the source files Xcode compiles. A header has nothing to compile. The Headers phase is the place where Xcode associates header files with a target.
# Xcode: select the target > Build Phases > Compile Sources, then type .h in the filter2Fix
Select the header in Compile Sources and press the minus button. If the header is part of a framework's API, add it to the Headers phase instead, in the Public, Private or Project section.
# Compile Sources: select the .h entry, click the minus (-) button
# Framework API headers: Build Phases > Headers > drag the file to Public, Private or Project3Verify
Build again. The count of matching lines should be 0.
xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep -c "no rule to process file"Confirmed by developer.apple.com
Cause 2 of 3
A resource or data file is listed in Compile Sources
1Check
Compile Sources holds source files to compile, so a data file there gets no compile rule. The phase that carries files into the finished app is Copy Bundle Resources, which copies them to the bundle's resource directory.
# Xcode: target > Build Phases > Compile Sources and Copy Bundle Resources, compare the two lists2Fix
Remove the file from Compile Sources. If the app reads it at run time, add it to Copy Bundle Resources. If it is only a note or a developer tool, keep it out of every phase. Never add the target's Info.plist to Copy Bundle Resources: Xcode processes it from the INFOPLIST_FILE setting on its own.
# Compile Sources: select the file, click the minus (-) button
# Copy Bundle Resources: click the plus (+) button, add the file3Verify
Build again and confirm the warning no longer prints.
xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep -c "no rule to process file"Confirmed by developer.apple.com
Cause 3 of 3
A genuine source file has a custom type that no build rule covers
1Check
Xcode chooses the tool for every file from the built-in build rules or the project's own. Open the target's Build Rules tab and look for a rule whose pattern matches the file.
# Xcode: select the target > Build Rules tab2Fix
Add a rule: click plus, set Process to source files with names matching your pattern, and give a script or an existing tool. The script reads the input path from SCRIPT_INPUT_FILE. Declare the output under DERIVED_FILE_DIR, so Xcode knows when to rebuild.
# Build Rules > +
# Process: Source files with names matching *.recipe
# Output Files: $(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).compiledData
# Script (compile-recipe is your own tool):
"$SRCROOT/tools/compile-recipe" "$SCRIPT_INPUT_FILE" "$SCRIPT_OUTPUT_FILE_0"3Verify
Build again. The warning is gone and the declared output file exists in the derived files folder.
xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep -c "no rule to process file"Confirmed by developer.apple.com
How do I stop it coming back?
- After adding a file to a target, open Build Phases and check which list it landed in: code in Compile Sources, resources in Copy Bundle Resources, framework API headers in Headers.
- Keep notes, scripts and other developer-only files out of every build phase.
- Leave Info.plist out of Copy Bundle Resources.
- Count this warning in the build log as a to-do: a file in the wrong phase can mean a resource is missing from the app.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Mobile apps
Xcode cannot find a build input file that a script should create
Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
Xcode's build system plans every step from declared inputs and outputs.
3 causes, each with a fixMobile apps
Xcode cannot find the Info.plist the target points at
The file "Info.plist" couldn't be opened because there is no such file.
Xcode reads the Info.plist path from the target's INFOPLIST_FILE build setting, relative to the project.
3 causes, each with a fixMobile apps
Cannot change the App Privacy answers in App Store Connect
Publish Your App Privacy Responses?
Only the Account Holder, Admin and App Manager roles can answer the App Privacy questions.
2 causes, each with a fixMobile apps
App record creation fails because you lack permission
You cannot add a new app in App Store Connect as a Developer or limited user
Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.
3 causes, each with a fixMobile apps
You cannot find the button to pull your app back from review
No 'remove this version from review' message appears on the version page
There is no button called Reject Binary.
3 causes, each with a fixMobile apps
Your Apple Account cannot sign in to App Store Connect
Sign-in to App Store Connect is refused for an account that should have access
App Store Connect does not open to every Apple Account.
3 causes, each with a fix