Xcode 9.3 Playground - diagnosticd

diagnosticd is a daemon you need to stop/kill with launchctl. The daemon you most likely need to stop has 'SimDevice' in its name. To get the exact name do:

/bin/launchctl list | grep SimDevice

Then with the appropriate name(s) (there could be more than 1) do:

/bin/launchctl stop 'name'

In my case 'name' was: com.apple.CoreSimulator.SimDevice.380EFF06-B636-49CD-851E-5DB4890641AE

If you use Playground a lot and you usually have more than 1 simulator eating your CPU run this script instead:

/bin/launchctl list | grep SimDevice | awk '{print $3}' | xargs -I %s /bin/launchctl stop %s

Oh, and dont forget to file a bug report with apple here: https://bugreport.apple.com/web/

Btw, its kinda fun to see playground/diagnosticd struggle with your code; if you create a bug or some other elaborate syntax, cpu goes up. If you clear it, cpu goes down (just a bit). Almost hilarious how Apple implemented this...


Get Xcode 9.4 Beta. It resolved my issue.

killing homed is not good solution and playground is not acting correctly anyway.

Had same issue and there was no way around it. People filed bugs as far back as April 8th.

Best solution is to download Xcode 9.4 Beta from Apple Developer Page.

This worked for me and CPU usage is low and Xcode doesn't crash on playgrounds anymore.


As a temporary workaround, I run this script after starting up a playground to kill the rogue diagnosticd and homed processes:

#!/bin/bash
kill $(ps -ef | grep Xcode.app | egrep "diagnosticd|homed" | awk '{ print $2 }')

Edit: This seems to be a problem with iOS playgrounds only, so another (less drastic) workaround is to use a macOS playgrounds for those cases where no UIKit components are needed.

2nd Edit: This bug appears to be fixed in Xcode 9.3.1 (available via MAS or direct download from developer.apple.com)

3rd Edit: 9.3.1 doesn't fully fix this, despite what the Release Notes say. According to the comments in my bug report, this is only be fully fixed in 9.4.

Tags:

Xcode