61

After installing Xcode 9 beta, Xcode 8 gives me an error when compiling a project:

Cannot find cdtool at '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/cdtool': Cannot find a simulator runtime for platform <DVTPlatform:0x7fd67af0a930:'com.apple.platform.iphonesimulator':<DVTFilePath:0x7fd67af0a7c0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform'>>.

I suspect Xcode 9 modified some shared state with Xcode 8 (set a path, overwrote a file, etc.). But I've tried deleting and both Xcodes to no avail.

The project uses Core Data and it's clearly failing when trying to compile the xcdatamodel.

I can still compile and run under Xcode 9.

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58
Jason C. Howlin
  • 3,858
  • 3
  • 21
  • 29

4 Answers4

186

An Apple engineer reached out about this...

Those of you with cdtool errors in Xcode 8, I suspect you installed the iOS 10.3 Simulator runtime from Xcode 9. It was discovered this week that this causes a problem with cdtool in Xcode 8.3.

You can work around that by moving iOS 10.3.simruntime aside and restarting CoreSimulatorService (source):

sudo mkdir /Library/Developer/CoreSimulator/Profiles/Runtimes/Backup 

sudo mv /Library/Developer/CoreSimulator/Profiles/Runtimes/{,Backup/}iOS\ 10.3.simruntime 

sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService 

Then restart Xcode, Simulator, etc. Those of you that deleted CoreSimulator.framework and thus cannot run Xcode.app any more can reinstall CoreSimulator.framework with:

installer -pkg /Applications/Xcode-beta.app/Contents/Resources/Packages/XcodeSystemResources.pkg -target /
Cœur
  • 37,241
  • 25
  • 195
  • 267
Jason C. Howlin
  • 3,858
  • 3
  • 21
  • 29
  • after moving my simulator to the backup folder my Xcode can't find the iOS10.3 simulator anymore. What is the solution for this? – Vasil Nunev Jun 12 '17 at 11:09
  • @VasilNunev that's the main problem with this solution, you are in fact moving iOS 10.3 out of reach so it won't show up. I need to test with iOS 10 so I guess I'll have to continue working with Xcode 8 buggy editor :( – Lluis Gerard Jun 29 '17 at 14:42
  • I just decided that to use Xcode 9 and develop for iOS 10, I run on device. Until they fix it, of course. – Jason C. Howlin Jun 29 '17 at 18:58
  • @VasilNunev Any chance you forgot to restart (kill) the CoreSimulatorService after moving the folder? It works fine for me after the forementioned 'sudo killall ...' line (plus restarting Xcode/Simulator). – Jerrot Jul 20 '17 at 12:53
  • This worked for me too, Thank You!!! -- FYI, In my case, this happened when I tried to build an iOS10 app in XC 8.3.3 to an iOS9 phone. I do have XC9 installed too, but the problem didn't show up until this case. the instructions here fixed the problem. – jonbauer Jul 27 '17 at 06:12
  • 1
    Today Sept 19, XCode 9 GM out and this is still and unresolved error xD – yeradis Sep 19 '17 at 07:57
5

Didn't work for me because I also have a Watch app and got the error on the Watch SDK.

I ended up deleting both Xcode 8 and 9 Beta, deleting /Library/Developer and ~/Library/Developer. Then reinstalled Xcode 8 and it worked.

Matt H
  • 6,422
  • 2
  • 28
  • 32
  • 2
    This is bad advice. Please don't follow it. You should not delete the content in /Library/Developer as that will cause Xcode 9 to fail to launch (and it will not -reinstall the content because it expects it to not be deleted by the user). – Jeremy Huddleston Sequoia Oct 14 '17 at 09:25
  • 1
    Anyone who accidentally did this can recover by manually installing /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg – Jeremy Huddleston Sequoia Oct 14 '17 at 09:26
0

You can also remove the 10.3 folder from /Library/Developer/CoreSimulator/Profiles/Runtimes

Restart Xcode in order to take effect (may not be needed).

Dare2dream
  • 76
  • 4
0

I agree with this answer. In addition I first removed all existing(took backup) Xcode version from machine.Then kept xcode 8.3.3 in Application folder. Made the project to open with default Xcode 8.3.2. Problem got resolved.

The problem came when I updated Xcode 9 beta to 9.2.

Sam Spencer
  • 8,492
  • 12
  • 76
  • 133
Ajeet Sharma
  • 214
  • 2
  • 9