xcode_backend.sh: no such file or directory. Do I need to create this file?

Issue

My Flutter Project won’t run on the ios simulator and is throwing this error:

Launching lib/main.dart on iPhone Xʀ in debug mode…

Running Xcode build…

Xcode build done. 7.6s

Failed to build iOS app

Error output from Xcode build:

** BUILD FAILED **

Xcode’s output:

=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===

/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

Could not build the application for the simulator.

Error launching application on iPhone Xʀ.

The xcode error was also as follows:

/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

I’ve already tried running flutter doctor and there were no errors.
I also tried re-rooting my xcode ‘FLUTTER_ROOT’ and ‘FLUTTER_APPLICATION_PATH’ in build settings, which did not work.

Solution

Basically what happens is that one of the project’s ‘Build Phases’ is running a script:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build

Now in order to find xcode_backend.sh the FLUTTER_ROOT variable needs to be defined. It is defined in a file called Flutter/Generated.xcconfig, which is generated when you run flutter pub get or flutter build.

The build configuration files Debug.xcconfig and Release.xcconfig (in the same Flutter folder) include Generated.xcconfig.
Now the only thing left is to ensure that for each of the project configurations these build configuration files are properly set (in XCode under Project > Info > Configuration).

Answered By – Sebastian Engel

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *