Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Xcode warns that a Run Script phase runs on every build

ErrorRun script build phase 'Module' will be run during every build because it does not specify any outputs.

Short answer

Xcode runs a Run Script phase on every build when it has no input files, no output files, changed inputs or missing outputs. The warning appears for the no-outputs case. Give the phase at least one input and one output file that really exists after it runs, and the warning goes and the script only runs when needed.

  • Applies to Xcode 26, macOS 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find which phase the warning names and look at its Input Files and Output Files lists in the project file.

    grep -n -B2 -A12 "PBXShellScriptBuildPhase" MyApp.xcodeproj/project.pbxproj
  2. 2Match what you see, then jump to its fix

    1. 1The warning names the phase and the Output Files list is emptyThe phase declares no output fileFix
    2. 2An Output File is listed, but the warning or the repeated run staysThe declared output is never created, so it always counts as missingFix
    3. 3Outputs are declared, but Xcode keeps running the phaseA script with no real input still needs an input fileFix

What does the error look like?

  • Run script build phase 'Module' will be run during every build because it does not specify any outputs.

Cause 1 of 3

The phase declares no output file

1Check

Open Build Phases for the target and expand the Run Script phase. Apple lists the conditions that make Xcode run a script: no input files, no output files, changed inputs, or missing outputs.

grep -n "outputPaths\|inputPaths" MyApp.xcodeproj/project.pbxproj

2Fix

Add one input file and one output file. If the script produces nothing, make it create a small static file and list that file as the output.

# Output Files:
$(DERIVED_FILE_DIR)/script-ran.stamp

# last line of the script:
touch "${SCRIPT_OUTPUT_FILE_0}"

3Verify

Build twice. The second build skips the phase and shows no warning.

xcodebuild -scheme MyApp -destination 'generic/platform=iOS Simulator' build 2>&1 | grep -i "every build"

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 3

The declared output is never created, so it always counts as missing

1Check

After a build, check whether the file at that path exists. A script whose declared outputs are missing is run again on the next build.

xcodebuild -scheme MyApp -showBuildSettings | grep " DERIVED_FILE_DIR "
# then list that folder with ls -l and look for the declared file name

2Fix

Make the script write exactly the declared path, preferably through the SCRIPT_OUTPUT_FILE_0 variable Xcode sets for the first output.

mkdir -p "$(dirname "${SCRIPT_OUTPUT_FILE_0}")"
./tools/generate.sh > "${SCRIPT_OUTPUT_FILE_0}"

3Verify

Build twice and confirm the script log appears only the first time.

xcodebuild -scheme MyApp -destination 'generic/platform=iOS Simulator' build

Confirmed by developer.apple.com

Did this fix it?

Cause 3 of 3

A script with no real input still needs an input file

1Check

Apple says a script without any input files runs every time, even if it does not need one.

grep -n "inputPaths" MyApp.xcodeproj/project.pbxproj

2Fix

List a file that never changes as the input. For many files, use a file list with the .xcfilelist extension, one path per line.

# Input Files:
$(SRCROOT)/Scripts/generate.sh

3Verify

Build twice; the second build must not run the phase.

xcodebuild -scheme MyApp -destination 'generic/platform=iOS Simulator' build

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Add input and output files to every new Run Script phase when you create it.
  • Prefer a file list (.xcfilelist) when the set of files changes often.
  • Treat build warnings as errors in CI so a new script without outputs is caught early.

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

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.