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 appears Error code 65 when running XcodeBuild en iOS On macOS, whether in local development or in 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, which makes it especially frustrating.

This failure is common when you work with tools like React Native, Xcode, Appium, Unity or CordovaThe worst part is that Xcode often provides little or no useful information in its logs, which makes troubleshooting even more difficult. But don't worry, we'll break down all the possible reasons why it appears and how to fix it in each case.

What does Xcodebuild error code 65 mean?

Explanation of error code 65 in xcodebuild

El 65 code on the tool xcodebuild It is a generic way of saying that Something went wrong during the compilation, testing, analysis, or archiving process of the project.Specifically, according to the technical documentation, this error is associated with data entry errors or unexpected conditions that are not recoverable for the tool.

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, from a project configuration error to permission issues, signatures, unstarted simulators, missing provisioning profiles, or even incompatibilities with dependency versions. If you want to delve deeper into configuring build environments, you can check out an article on the Ubuntu build.

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.
  Where is the iPhone clipboard and how to get the most out of it?

Error 65 in Xcodebuild using CircleCI or CI/CD systems

When running builds in automated environments like CircleCI, xcodebuild may fail if the environment is not yet “prepared”Many developers encounter error 65 because the simulator hasn't fully started yet when the build starts.

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 is also advisable to separate the Boot from the dependency fetching step simulator to gain more insight into which stage is failing in the pipeline. 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 launching tests with appium on real iOS devices. The usual cause is the inability to launches the WebDriverAgent correctly, the tool that 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:

  Complete guide to using Phone Link on Windows 11: setup, requirements, and all its features

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 can be useful for developers.

2. Run from Xcode for more explicit errors

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

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 are generating 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:

  iPhones that will stop updating in 2025: All the details

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

2. Examine the last step that appears before the failure. Many times the error is not where the mistake is made, but a few steps before.

3. Try compiling manually with Xcode and check if the error is repeated outside the automated environment.

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

As you can see, error code 65 does not mean a single thing, but can be derived from multiple causes depending on the context: native projects, React Native, Appium, CI/CD, Unity, etc. The key is in know how to interpret the logs, to understand How Xcode Signing and Configuration Works, and adopt good practices such as simulating real environments, using detailed logs and cleaning the leftover artifactsWith a little patience and a systematic approach, this error can be resolved and no longer a nightmare that holds back iOS development.

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