Final solution to Xcodebuild error code 65 in iOS builds

Last update: 14/04/2025
Author Isaac
  • Xcodebuild error 65 is usually related to signing, simulator, or environment configuration issues.
  • It manifests itself in multiple ways, both in native developments with Xcode and with Appium, React Native or Unity.
  • There are good practices that allow avoiding failure during continuous integrations or local executions
  • Review provisioning profiles and use logs detailed helps to better identify the origin of the failure

Xcodebuild error code 65 on iOS

When the dreaded error code 65 appears while running xcodebuild on iOS or macOS, whether in local development or continuous integration environments, it can feel like everything has crashed. It's one of those generic errors that doesn't clearly indicate what went wrong, making it especially frustrating.

This error is common when working with tools like React Native, Xcode, Appium, Unity, or Cordova . The worst part is that Xcode often provides very little useful information in its logs, making it even harder to resolve. But don't worry, we're going to break down all the possible reasons why it occurs and how to fix it in each case.

What does Xcodebuild error code 65 mean?

Explanation of error code 65 in xcodebuild

Error code 65 in the xcodebuild tool is a generic way of saying that something has gone wrong during the compilation, testing, analysis, or archiving of the project . Specifically, according to the technical documentation, this error is associated with data input errors or unexpected conditions that the tool cannot recover from.

Just like HTTP codes (such as 404 or 200), These exit codes indicate what happened but they don't give any details. In this case, the 65 corresponds to a constant defined in the file sysexits.h and its description is “EX_DATAERR”, that is, failure due to incorrect data.

This can have multiple causes, ranging from a project configuration error to permission issues, signature problems, unstarted simulators, missing provisioning profiles, or even dependency version incompatibilities. If you want to delve deeper into configuring build environments, you can review an article on Ubuntu compilation.

Common causes of Xcodebuild failing with code 65

As observed in different environments such as Appium, Cordova, CircleCI and native Xcode projects, the main reasons for the failure are:

  • Expired or unconfigured provisioning profiles.
  • Problems with code signing (Code Sign Identity).
  • Simulators not started or unavailable at the time of building or testing.
  • Corrupted configuration files or incompatible (for example .xcconfig misspelled).
  • Intermediate build steps fail, such as CopyPNG, CodeSign or ProcessProductPackaging.
  • Thread concurrency slows down simulator boot in CI environments such as CircleCI or Azure Pipelines.
  • Improper use of Apple Silicon machines (M1, M2…) regardless of architectural differences.
  How to understand all the symbols on mobile phone chargers

Error 65 in Xcodebuild using CircleCI or CI/CD systems

When running builds in automated environments like CircleCI, xcodebuild can fail if the environment isn't yet "ready ." Many developers encounter error 65 because the simulator hasn't fully started when the build begins.

A recommended trick is to manually start the simulator beforehand with the command:

xcrun instruments -w 'iPhone 7 (10.3)' || sleep 15

Thus, the system is given time to start the simulator correctly. Even the sleep 15 later helps the command return code 0 and not cause another chain of errors.

It's also helpful to separate the simulator startup from the dependency acquisition step to gain a clearer understanding of which stage in the pipeline is failing. For more details on continuous integration, you can visit this link about Ethereum and CI/CD.

Error 65 in Appium with WebDriverAgent

WebDriverAgent and error code 65 in Appium

One of the most frequent cases of error 65 occurs when running tests with Appium on real iOS devices. The usual cause is the inability to launch the WebDriverAgent correctly , the tool Appium uses to communicate with the iOS device.

In most cases, this failure is due to:

  • WebDriverAgent not signed correctly or without a valid provisioning profile.
  • Incorrect Bundle Identifier or that does not match the configured certificate.
  • Appium version incompatible with WebDriverAgent.

The solution is to properly sign the WDA and ensure there are no errors related to the entitlements or signing identity. It is also recommended to delete the WebDriverAgent application from the device and reboot it before retesting the build. It may also be helpful to use the option showXcodeLog for more detailed information on the underlying error.

Working with React Native and code 65 error

If you are using React Native and you encounter this error when launching npx react-native run-ios, make sure of the following:

  AirTag and location files: a complete guide to use and privacy

1. Install the pods correctly

One of the most common causes is that native dependencies aren't installed correctly. To fix this:

npx pod-install

Once completed, you can run the project again. If you need to update your environment, there are guides on how to install Ghostty on Linux , which may be helpful for developers.

2. Run from Xcode for more explicit errors

When CLI commands don't provide useful information, it's best to open the project in Xcode and build it from there. This will allow you to see clearer errors related to libraries, devices, or configurations.

3. Check connected devices

Check if you have multiple active simulators and explicitly select one when launching the project:

npx react-native run-ios --simulator="iPhone 15 Pro"

4. Reset the pods

Some conflicting libraries or remnants of previous configurations cause errors. A reset usually helps.

cd ios
pod deintegrate
pod cache clean --all
pod setup
pod install

5. Apple Silicon (M1, M2, M3 chips)

Apple's new chips cause build errors if commands aren't executed on x86 architecture. In that case, try the following:

sudo arch -x86_64 gem install ffi
arch -x86_64 pod install

Unity and error 65 during archiving

In projects created with Unity that are then exported as Xcode projects to compile on iOS, error 65 may occur during the build step. xcodebuild archive. Even if everything is configured correctly, Xcode may fail with problems in steps like:

  • Process Product Packaging
  • CodeSign
  • Validate

Even if the profiles and certificates are correct, there may be errors in the generation of entitlements or intermediate packages. Sometimes it helps to delete the folder DerivedData, clean up the products within Xcode, and ensure that the Unity and Xcode versions are compatible. For more information on software versions, check out our post on How to know the version of Windows 11.

Errors without a visible clue: what to do

In many scenarios (e.g. using Azure Pipelines or GitHub Actions), the error appears without clear accompaniment in the log even with flag --verboseIn these cases:

  How to extract data from a wet mobile phone before it's too late

1. Increase log levels. Uses showXcodeLog, -verbose and saves temporary log files for analysis at a glance.

2. Examine the last step before the failure . Often the error is not where the failure occurs, but a few steps earlier.

3. Try compiling manually with Xcode and check if the error occurs outside of the automated environment.

This way, you can isolate whether the problem lies with the project itself or the environment configuration. Remember that understanding build workflows can help prevent problems, so consider reading about error screens in systems.

As you've seen, error code 65 doesn't mean just one thing; it can stem from multiple causes depending on the context: native projects, React Native, Appium, CI/CD, Unity, etc. The key is knowing how to interpret the logs , understanding how Xcode's signing and configuration work , and adopting best practices such as simulating real-world environments, using detailed logs, and cleaning up leftover artifacts . With some patience and a systematic approach, this error can be resolved and cease being a nightmare that hinders iOS development.

build number phone
Related articles:
What is the purpose of the Telephone Compilation Number?