Command PhaseScriptExecution failed with a nonzero exit code - No such file or directory

Hello there, I have been struggling with configuring Apollo for a while now and can’t solve the problem. I am currently stuck in the code generation build step where I added a run script. I have tried several solutions such as ticking “For install builds only” which removed the problem but then the problem is that there is no API.swift file being generated.

Looking at the derived data folder it seems like the is missing. I am not sure where to get it? I do however have a maybe I have to change to that one in my run script instead? I have added an image of the problem and my run script.

Xcode version: 13.4.1
Apollo version: 1.0.5
Apollo/2.33.4 darwin-arm64

Schema is a schema.json and not schema.graphqls

if [ $ACTION = “indexbuild” ]; then exit 0; fi


while ! [ -d “${DERIVED_DATA_CANDIDATE}/SourcePackages” ]; do
if [ “${DERIVED_DATA_CANDIDATE}” = / ]; then
echo >&2 “error: Unable to locate SourcePackages directory from BUILD_ROOT: ‘${BUILD_ROOT}’”
exit 1



if [ -z “${SCRIPT_PATH}” ]; then
echo >&2 “error: Couldn’t find the CLI script in your checked out SPM packages; make sure to add the framework to your project.”
exit 1

“${SCRIPT_PATH}”/ codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=“schema.json” API.swift`

Hi @JoshuaB3 - it looks like you’re trying to mix instructions for versions 0.x and 1.x; they are not compatible. 1.0.0 was a breaking change release and will require you to update your configuration.

The build script you’re referring to is from the 0.x (legacy) installation documentation. I recommend taking a read through the documentation for 1.0.

The build problems you’re experiencing are because:

  • no longer exists. We no longer recommend a build script phase for code generation although it is possible with the new CLI.
  • Code generation no longer outputs a single API.swift file. It’s really worth the time reading the documentation for the new code generation engine.

Schema is a schema.json and not schema.graphqls

This is supported but you’ll need to correctly configure code generation to look for that schema file.