Xcode 9 Bug: Cannot find cdtool

IosXcodeXcode8Xcode9

Ios Problem Overview


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.

Ios Solutions


Solution 1 - Ios

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 /

Solution 2 - Ios

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.

Solution 3 - Ios

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).

Solution 4 - Ios

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.

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
QuestionJason C. HowlinView Question on Stackoverflow
Solution 1 - IosJason C. HowlinView Answer on Stackoverflow
Solution 2 - IosMatt HView Answer on Stackoverflow
Solution 3 - IosDare2dreamView Answer on Stackoverflow
Solution 4 - IosAjeet SharmaView Answer on Stackoverflow