error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65

XcodeReact Native

Xcode Problem Overview


I've build a react-native application and suddenly I get this error message on my terminal during run of the command react-native run-ios. The same code work fine 10 minutes ago and suddenly I get this error message. Please help...

Xcode Solutions


Solution 1 - Xcode

If you don't have cocoa pods installed you need to sudo gem install cocoapods

  1. run cd ios
  2. run pod install
  3. cd ..
  4. delete build folder
  5. run react-native run-ios

if the error persists,

  1. delete build folder again
  2. open the /ios folder in x-code
  3. navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System`

You should be good to go. I hope this helps.

Solution 2 - Xcode

  1. delete the build/ folder in ios/ and rerun if that doesn't do any change then
  2. File -> Project Settings (or WorkSpace Settings) -> Build System -> Legacy Build System
  3. Rerun and voilà!

In case this doesn't work, don't be sad, there is another solution to deeply clean project

  1. Delete ios/ and android/ folders.

  2. Run react-native eject

  3. Run react-native link

  4. react-native run-ios

This will bring a whole new resurrection for your project

Solution 3 - Xcode

SOLVED: Always be sure to update your Xcode folks!

Protip: And don't do it from the apple store (but always do it from an official apple website of course)

tip from: http://ericasadun.com/2016/03/22/xcode-upgrades-lessons-learned/

official apple download page: https://developer.apple.com/download/more/

For those who are unable to resolve with above method

  1. Go to project settings in Xcode. Menu File->Project Settings

  2. Go to per-User Project Settings section.

  3. Click on advanced.

  4. Select Xcode Default option. previously this used to be Legacy for my project.

I have analysed on similar lines and concluded that clean is causing the archive to fail. So, the new build system is not clearing the custom/legacy build directory.

delete the build/ folder in ios/ and rerun if that doesn't do any change then
File -> Project Settings (or WorkSpace Settings) -> Build System -> Legacy Build System
Rerun and voilà!

If it still Fails you need to clean full project

Do the following:

  • Delete ios dir manually
  • Clean cache Run npm cache clean --force
  • Run react-native eject
  • Re-install all packages npm install
  • Run the link command react-native link
  • Finally run react-native run-ios

Solution 4 - Xcode

cd ios && rm Podfile.lock && pod install worked for me.

And perhaps few updates if the first didn't help as much, as:

sudo gem install cocoapods
rm Podfile.lock && pod install --repo-update

Solution 5 - Xcode

For me it caused by installing react-native-vector-icons and linking by running the react-native link react-native-vector-icons command.

I just unlinked the react-native-vector-icons by following commands

  1. react-native unlink react-native-vector-icons
  2. cd ios
  3. pod install
  4. cd ..
  5. react-native run-ios

As I already installed an other icon library.

Solution 6 - Xcode

I had the same error, but it was caused by the package manager process port being already used (port 8081).

To fix, I just ran the react-native by specifying a different port, see below.

react-native run-ios --port 8090

Solution 7 - Xcode

If you don't have cocoa pods installed you need to:

sudo gem install cocoapods

Then run:

cd /ios
pod install

delete the build folder in ios folder of your react native project

run:

react-native run-ios

if error persists:

  • delete build folder again
  • open the /ios folder in Xcode
  • navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System

Solution 8 - Xcode

After upgrading react-native, you may have stale dependencies. The steps below should fix it.

  1. cd ios
  2. delete Podfile.lock
  3. pod deintegrate && pod install
  4. Navigate back to package.json directory
  5. run react-native run-ios
  6. In Xcode you can build your project again too

Hope this helps, I did this after upgrading to react-native 0.61

Solution 9 - Xcode

Should always start with the simplest first, after wasting hours and days on this error.

And after an extensive amount of research,

Simply

RESTART YOUR MACHINE

This resolved this error.

I'm on

react-native-cli: 2.0.1
react-native: 0.63.3

Solution 10 - Xcode

This problem may occur after installing react-native-vector-icons

  1. Open the project in Xcode.
  2. Go to build phases.
  3. go to Copy Build resources.
  4. Remove all .ttf files from here.
  5. Run the application. enter image description here

Solution 11 - Xcode

A popular reason to builds failing and error code 65 is a missmatch between cached pod files and current packages used. Here is how to remove the cache and recreate the pods.

1. Delete Derivate Data - Remove data that includes cached info of the project Example how to do it: https://www.youtube.com/watch?v=f8bTvx0Aoyo

2. Delete .xcworkspace file from ios folder - This is the Xcode project file that gets created when you run pod install we want to recreate it in step 4. This project file uses pods and has a white coloured icon instead of the blue coloured base project without pods.

3. Delete Podfile.lock - Remove old dependencies info so we can recreate them in the next step.

Do a pod-install in ios folder or npx pod-install in root with (React native) - Here we download the pod dependencies again and the pod files only the ones that are used from the current packages are downloaded. A .xcworkspace is regenerated

Solution 12 - Xcode

In my case, the issue was with my Xcode build scheme. When you run react-native run-ios you may see something like,

  • info Found Xcode workspace "myproject.xcworkspace"*

  • info Building (using "xcodebuild -workspace myproject.xcworkspace -configuration Debug -scheme myproject -destination id=xxxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxx -derivedDataPath build/myproject")*


In this case, there should be a scheme named myproject in your ios configurations. The way I fixed it is,

> Double clicked on myproject.xcworkspace in ios directory (to open workspace with Xcode) > > Navigate into Product > Scheme > Manage Schemes... > > Created a Scheme appropriately with name myproject (this name is case-sensitive) > > Ran react-native run-ios in project directory

Solution 13 - Xcode

run pod install inside ios folder then go back to root folder and run npx react-native run-ios

Solution 14 - Xcode

What worked for me was to rename the project by removing the special characters.

Example: "project_marketplace" to "projectmarketplace"

In this case, I redid the project with react-native init and copied the src and package.json folder.

Solution 15 - Xcode

This could also be due to having custom named schemes, in that case:

  • cd ios
  • xcodebuild -list

Find your's, it might have a -dev suffix. Then:

  • cd .. (root of the app)
  • npx react-native run-ios --scheme custom-scheme-name

Solution 16 - Xcode

In my case everything solved after re-cloning the repo and launching it again.

Setup: Xcode 12.4 Mac M1

Solution 17 - Xcode

In my case, none of the answers resolved it, since am not able to open .xcworkspace at all. But the legacy comment hinted to a RN to Xcode <> compatibility issue, so i tried all the previous RN Versions and all below [email protected] seem to work with xcode 11.3.1 npx react-native init projectName --version 0.62.0

Thanks

Solution 18 - Xcode

Below work for me though I encounter error code 65 due to I rename an existing project name to a new name which I did for all the files within the project. My solution was :-

  1. At ios folder level open xworkspace with xcode.

  2. Click on file tab then click on workspace settings.

  3. I clicked on advance then I select xcode default then I clicked on close button.

  4. I clicked on scheme tab which is beside the stop button at the right then I clicked on edit scheme.

  5. When the edit scheme opened I clicked on build tab then I click on manage scheme button.

  6. I selected scheme of my project name then I clicked the minus(-) button to delete it then I clicked on close

  7. I clicked on clean build folder then when its complete I clicked on build tab to rebuild the project.

  8. I clicked on play button which i selected the simulator I want then everything work perfectly again.

Solution 19 - Xcode

I too had an issue with react-native-vector-icons causing this. I still wanted to use the icons though, and I was using VSCode

Workaround was to more or less the same as the manual instructions from the docs but a little different.

  1. npm install --save react-native-vector-icons

  2. copy the .tff files you want to use in node_modules -> react-native-vector-icons -> fonts

  3. create a new folder "fonts" in src -> ios ...paste the .tff files in there

  4. open 'info.plist' in src -> ios -> mobile

  5. on the line above </dict> paste:

<array>
    <string>AntDesign.ttf</string>
    <string>Entypo.ttf</string>
    <string>EvilIcons.ttf</string>
    <string>Feather.ttf</string>
    <string>FontAwesome.ttf</string>
    <string>FontAwesome5_Brands.ttf</string>
    <string>FontAwesome5_Regular.ttf</string>
    <string>FontAwesome5_Solid.ttf</string>
    <string>Foundation.ttf</string>
    <string>Ionicons.ttf</string>
    <string>MaterialIcons.ttf</string>
    <string>MaterialCommunityIcons.ttf</string>
    <string>SimpleLineIcons.ttf</string>
    <string>Octicons.ttf</string>
    <string>Zocial.ttf</string>
    <string>Fontisto.ttf</string>
  </array>

...or whatever fonts you selected.

I ran react-native run-ios and it worked like a charm.

Solution 20 - Xcode

In a React Native app, I removed some font assets that I previously linked. For some reason, they didn't get deleted from the Xcode project. I deleted them manually and then it worked.

Solution 21 - Xcode

I'm using M1 Mac, opening the terminal with Rosetta worked for me.

demo

Solution 22 - Xcode

Some changes in Podfile haven't been updated. Maybe one of your native dependencies has changed.

  1. expo prebuild --clean
  2. cd ios
  3. pod install
  4. yarn ios

Solution 23 - Xcode

For our project, we had to run the npx react-native link command in order to get the react native vector icons to show up on Android phones. But that added code to the ios/yourprojectname.xcodeproj/project.pbxproj file. And that caused the build to fail, throwing an error code 65 and listing out all the fonts that were duplicated.

So, to fix the error, we just removed all of the new code that was added by the npx react-native link command.

Solution 24 - Xcode

If you encountered issues with M1.

Try installing the ffi package and running install again.

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

Another solution that I found here works great, basically installing cacoapods with brew (and passing -arm64).

sudo gem uninstall cocoapods
arch -arm64 brew install cocoapods
cd ios
pod install

Solution 25 - Xcode

If you've built/run your app previous from Xcode and want to go back to using the terminal you need to clean your build folder. Go to product -> Clean Build Folder

Solution 26 - Xcode

there was some issue while creating the app so in my case i just deleted the package-lock.json and did npm i

after that

cd ios/ and pod install

Solution 27 - Xcode

Go to: ios > projectName.xcworkspace > xcshareddata > WorkspaceSettings.xcsettings and add

<key>DisableBuildSystemDeprecationDiagnostic</key>
<true/>

Link: https://gitlab.kitware.com/cmake/cmake/-/issues/22459

Image of Solution

Solution 28 - Xcode

Here is the a possible solution

The problem is found in RealmReact.xcodeproj

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIdan AsulinView Question on Stackoverflow
Solution 1 - XcodeNana AdjeiView Answer on Stackoverflow
Solution 2 - XcodeNagibabaView Answer on Stackoverflow
Solution 3 - XcodeAkshay MulgavkarView Answer on Stackoverflow
Solution 4 - XcodeSingh LalitView Answer on Stackoverflow
Solution 5 - XcodeAzhar ZafarView Answer on Stackoverflow
Solution 6 - XcodesturdynutView Answer on Stackoverflow
Solution 7 - XcodeDhruv GodaraView Answer on Stackoverflow
Solution 8 - XcodeICeZer0View Answer on Stackoverflow
Solution 9 - XcodeJonathan SanchezView Answer on Stackoverflow
Solution 10 - XcodeKunal NayekView Answer on Stackoverflow
Solution 11 - XcodePatrik Rikama-HinnenbergView Answer on Stackoverflow
Solution 12 - XcodeKGS SandaruwanView Answer on Stackoverflow
Solution 13 - XcodeHalalisani GoodpresentView Answer on Stackoverflow
Solution 14 - XcodeGuilherme TrivilinView Answer on Stackoverflow
Solution 15 - XcodeBorjanteView Answer on Stackoverflow
Solution 16 - XcodePatrik Rikama-HinnenbergView Answer on Stackoverflow
Solution 17 - XcodeSanthoshView Answer on Stackoverflow
Solution 18 - XcodeAlabi TemitopeView Answer on Stackoverflow
Solution 19 - Xcodethatguy1155View Answer on Stackoverflow
Solution 20 - XcodeTamás SengelView Answer on Stackoverflow
Solution 21 - XcodeBasir PayendaView Answer on Stackoverflow
Solution 22 - XcodeDaniel DanieleckiView Answer on Stackoverflow
Solution 23 - XcodeBlake McGillisView Answer on Stackoverflow
Solution 24 - XcodeaxtckView Answer on Stackoverflow
Solution 25 - XcodebmaggiView Answer on Stackoverflow
Solution 26 - XcodeAayush BhattacharyaView Answer on Stackoverflow
Solution 27 - XcodeTJDeveloperView Answer on Stackoverflow
Solution 28 - XcodeAngelView Answer on Stackoverflow