Solving Simulator Bootstrap Errors
I'm sure every iOS developer has seen the dreaded bootstrap error. "Couldn't register com.yourcompany.yourapp with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger." After nearly throwing my Mac out the window for the Nth time today, I finally managed to come up with a simple fix. Run this in the shell:
- launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl remove
launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl removeAnd your bootstrap errors magically melt away.
This occasionally happens when using Xcode to run iOS apps in the simulator. Although the error really gives no indication of it, it's apparently a hung launchd job that somehow doesn't get cleaned up. The above command lists out all launchd jobs, searches for one with UIKitApplication in the name (which will be the job corresponding to your app that's improperly sticking around), extracts the name, and tells launchd to get rid of that job.
I'm still not sure exactly why this error happens. And, as far as I know, the above can't be used on the actual device, so you still have to reboot those to solve it when it happens there, although that's much less painful than rebooting your development Mac. But the above works just fine as a workaround until Apple can get their act together on this problem. I saved the command into a shell script called unfuckbootstrap that I can use whenever Xcode decides to screw up.
Recent Comments