106

I'm getting this message when I try to run an Xcode iOS project on my iPhone 8:

This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.

I'm using Xcode 13.2.1 and iOS 15.4.

I've tried the different solutions given in other posts here on StackOverflow, but I haven't been able to fix the problem. This one seems to be the latest identical question, just with previous versions of Xcode and iOS.

This post in this forums gives the solution to restart the iOS device and I did that and also restarted the mac. My Mac has macOS Monterey 12.3. My Xcode, Mac, and iPhone 8 all have the most recent updates. That post gives an answer for the same problem but with iOS 15.2.

I have recently changed settings in my iPhone 8 in Accessibility. Could that affect anything?

I found this error in the Xcode console for my device. Does this say anything about my problem?

com.apple.analyticsd xpc error 08:10:31.756711-0500 analyticsd [XPC Server] managed connection recieved connection invalidated: Connection invalid

2
  • 2
    Restart you iPhone and it'll work just fine. Thanks Commented Jun 30, 2022 at 5:22
  • 11
    Restarting does not solve it in all cases
    – Ade
    Commented Sep 23, 2022 at 15:39

18 Answers 18

291
  1. Check /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ for directory name 15.4 (your iOS version).
  2. If the directory is missing download support files for 15.4 (your iOS version) from https://github.com/filsv/iPhoneOSDeviceSupport and place it in the above path.
  3. Restart Xcode.
27
  • 8
    Thanks for this, which sorted everything. Once I downloaded the 15.4.zip file from the link above, I unzipped it in the Downloads directory, then moved the 15.4 folder to the DeviceSupport directory. I did that with the help of this article: medium.com/@nayananp/…. I then used 'chown' and 'xattr' to make everything the same as regards file groups and owners. Then shut down Xcode, my Mac, and my phone. Once I restarted everything and plugged my iPhone back into my Mac, I could finally recompile and see the app on the phone! Commented May 4, 2022 at 15:54
  • 4
    If you are on iPhone iOS version 15.6 it is enough to download the zip version 16.0 - no need to change anything there.
    – ksysha
    Commented Aug 2, 2022 at 15:34
  • 3
    I'm on 15.6 and downloading 16.0 did not work for me. I tried renaming it to '15.6' (another article I read suggested renaming for example 15.3.1 -> 15.3) but no success. Commented Aug 9, 2022 at 19:30
  • 6
    @GabrielJensen try 15.6 from here github.com/JinjunHan/iOSDeviceSupport
    – Vignesh
    Commented Aug 17, 2022 at 3:50
  • 11
    Why would you need to download that from some github repository? Isn't there a "official" mechanism in xcode to download those files?
    – hannojg
    Commented Sep 11, 2022 at 12:01
66

Solution : Reboot iPhone.

I have the latest version of :

  • iOS
  • Xcode

Still was not able to run the app on my device.

Solution that worked for me: simple iPhone restart

9
  • 9
    once again "Have you tried turning if off and on again?" saves the day. TY for reminding me ;)
    – Sebastian
    Commented May 3, 2022 at 9:34
  • 2
    just a simple restart of the ios worked for me too! :D
    – Johanna
    Commented Jun 2, 2022 at 8:16
  • 2
    This is what worked for me. Embarrassed I didn't think of it first. Commented Jul 1, 2022 at 3:58
  • 2
    Lol such a shame. Indeed restarting my iPhone 11 Pro Max works! Commented Jul 1, 2022 at 20:53
  • 2
    Same this happened for iPadOS. wow. 15.6.1. XCode Version 14.0.1 (14A400)
    – vr_driver
    Commented Sep 29, 2022 at 4:06
38

Following solution work for me

  1. First check compatibility version for xcode with iOS version from following https://developer.apple.com/support/xcode/
  2. Now check the list of devices support to your Xcode from 'Device Support'
  3. To get into 'Device Support' :: Open Finder -> Applications -> Scroll to Xcode -> Right Click -> Show Package Contents -> Contents -> Developer -> Platforms -> iPhoneOS.platform -> DeviceSupport This is the list of devices folder support for your Xcode
  4. Now check for your iOS version from iPhone device :: Open Settings from iPhone -> General -> About -> Software Version
  5. If the 'Device Support' folder does not contains the folder of your iPhone iOS Version, then you need to add respective folder from following link https://github.com/iGhibli/iOS-DeviceSupport/tree/master/DeviceSupport
  6. From above Github page, select device version & download zip file
  7. Now extract file & you will get the folder for your iOS version
  8. Copy this folder into Finder -> Applications -> Scroll to Xcode -> Right Click -> Show Package Contents -> Contents -> Developer -> Platforms -> iPhoneOS.platform -> DeviceSupport
  9. Disconnect device (if connected), restart xcode
  10. Before connecting device, delete derived data from xcode & clean cache using cmd + shft + k. Then make sure to reset 'Location & Privacy' from device :: From iPhone device go to Settings -> General -> Transfer or Rest Phone -> Reset -> Reset Location & Privacy -> Enter passcode to continue
  11. Now connect your iPhone device with macbook (through cable), xcode will detect your device & you can run your application

https://stackoverflow.com/a/72143610/15716725

0
18

for Xcode 13.2.1, and running on the device with iOS version 15.5 https://github.com/filsv/iOSDeviceSupport/blob/master/15.5.zip download this zip and extract it into

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ for directory name 15.5 (your iOS version).

and restart the xocode

enter image description here

1
  • Huh, you could have been my man with this but unfortunately there's no runtime for 15.8 there since November 2023, they stopped at 15.7. I hope the guy behind this Github page didn't die in covid.
    – Vendrel
    Commented Feb 1 at 17:13
10

I installed iOS 16.0 beta and faced this message on Xcode.

This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode.

In my case, I enabled developer mode on the device, and it worked.

You can follow this path for activating developer mode on your iOS device.

Settings > Privacy & Security > Developer Mode

0
5

For all of you having problem with iOS 15.7 on device. Apple is aware of it.

https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes

Xcode 14 cannot be used with iOS 15.7 for development. (99847608)

There is workaround for it

Workaround: Use Xcode 13.4.1 with iOS 15.7.

2
  • That’s a massive mistake by Apple
    – Ade
    Commented Sep 23, 2022 at 15:42
  • You no longer have to: xcode 14.0.1 works with 15.7 Sometimes after iOS device reboot ;^) Commented Sep 27, 2022 at 14:26
3

I'm using Xcode 13.2.1 and iOS 15.4 on my iPhone 8

That's the problem. Your Xcode is incompatible with your iPhone system. Update to Xcode 13.3.

My Xcode, Mac, and iPhone 8 all have the most recent updates

No, they don't.

2

Dowloading latest xcode beta version was the only solution for me:

https://developer.apple.com/download/all/

2

Previous fix (non-working)

The workaround from @Simeon is not working any more for iOS versions above 16.0

I would like Apple to do its job and create a stable fix. Apparently, they are entitled to make more money, not great pieces of software anymore.

Current fix

In order to fix this, the easiest (but clearly not the fastest nor the most efficient) is to delete and reinstall Xcode or its beta.

Assumptions

The issue essentially comes from the fact that one folder is missing in order to run later versions of iOS, and Xcode is not fetching them for i-don't-know what reasons.

All pieces of software and OS are up-to-date As you can see in the screenshot above, all pieces of software and OS are up-to-date.

The folder for iOS 16.4 is missing.

Nevertheless, the folder for iOS 16.4 is still missing.

4
  • 1
    You can find the device support for 16.4 if you download the RC3 from the developer website and extract its contents. That's what I just did. Commented Mar 29, 2023 at 12:49
  • You may need to get the latest XCode 14.3 in order to have 16.4. Otherwise need to find related files from github shared by community.
    – Thomas Lee
    Commented Apr 3, 2023 at 12:01
  • U need to update XCode. It saved me.
    – North Face
    Commented Apr 6, 2023 at 7:16
  • 1
    @ThomasLee I have updated to XCode 14.2. Yet there are no 16.x directories under iOS. GitHub has only till 16.5, but my iPhone 8+ has iOS 16.7. I moved the contents of GitHuB 16.5 under a folder named 16.7 and placed it under DeviceSupport. It solved my problem instantly. While Apple painfully installs all the Jurrassic Park versions of iOS under Device Support, it's strange that it chose to ignore the latest versions. In fact, I did a fresh XCode 14.2 download and installed it yesterday only. Still, it didn't have any folders for iOS 16.x.
    – Seshadri R
    Commented Oct 7, 2023 at 16:45
2

I had the same issue when upgraded my phone to ios 16.4. When I opened Window -> Devices and Simulators this message was displayed. As others have mentioned upgrading xcode made it work again:

Failed to prepare the device for development.
This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your Mac and device in order to correctly detect compatibility.

The App Store app did not show any updates, I had to search for xcode to see an update-button, no automagic in this case.

1

My iPhone was 15.5, and I checked /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport, there is no such 15.5, then I noticed update notification for Xcode in AppStore, which is said Version 13.4.1 - Xcode 13.4.1 includes SDKs for iOS 15.5, ..., then I just need to execute Xcode update

1

I actually downloaded the 15.5 version and renamed it as 15.6, I have also done this before when I was using the iOS 11.*** version, it worked in few of the cases.

1

Apple has addressed this issue. See the following thread with a link to the Xcode 14.0.1 Release Candidate. Open the .xip file and then the run Xcode.app within. I was able to build my app on a device with iOS 15.7. I believe you have to be a paid Apple Developer to open the link.

https://developer.apple.com/forums/thread/714388

1

For those with an issue relating to XCode 15 and iOS 17 as a result of the various beta issues with trusting devices and the duplicate notification Known Issue (109539668). This issue results in getting stuck in the same place "Previous preparation error: The tunnel connection failed while the system tried to connect to the device.. The tunnel connection failed while the system tried to connect to the device.".

I was hopeful that the final release of each of these would be the end of the issue. Alas it was not. I reset my iPad completely, Settings -> General -> Transfer or Reset iPad -> Reset (a total pain I know) and both the duped notification and connection issues with mac are resolved.

1

For the 15.8 version of iOS not working, use this solution: https://github.com/iGhibli/iOS-DeviceSupport/issues/237.

After you go here (as mentionned in the other answers): Open Finder -> Applications -> Scroll to Xcode -> Right Click -> Show Package Contents -> Contents -> Developer -> Platforms -> iPhoneOS.platform -> DeviceSupport This is the list of devices folder support for your Xcode

Copy the 15.5 folder and rename it 15.8.

Reboot XCode, unplug and replug the phone, and it should work.

0

I had the same problem so i had to update xcode to the latest version

Issue

xcode version was 14.0.1 - which supported iOS 16.0 (20A360), but my iphone is having 16.3.1 version.

Solution

Updated Xcode with 14.3

0

My case is likely fringe/rare but in case it helps anyone:

  • I was getting this annoying "Failed to prepare device for development" error for my iPad 12.9 iOS 16.4.1 in Xcode 14.2 (as of 1/28/24)
  • None of the delete derrived data, reboots, etc above fixes worked
  • I downloaded the 16.4 zip from this site (mentioned above):
  • I extracted to here as a folder named "16.4" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
  • However it still did not work / gave same error
  • I then renamed the 16.4 folder to "16.4.1', unpaired and retried ... then the error finally went away and I can use my iPad for testing local builds again
-1

Following the solution of:

Adding the folder the iOS version to the path of XCode:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/

enter image description here

I had the problem for iOS 16.6 and I couldn't find it at https://github.com/filsv/iPhoneOSDeviceSupport at the moment, so I found this other repo with the lastest versions https://github.com/JinjunHan/iOSDeviceSupport

After restarting my phone and xCode it works.

Not the answer you're looking for? Browse other questions tagged or ask your own question.