How to resolve “Unable to start status bar server” when launching GHUnit Tests from command line after upgrading to XCode 5

Posted on September 22, 2013

After upgrading to XCode 5 my Jenkins Continuous Integration machine over at Xebia stopped executing command-line GHUnit tests under some apparently random conditions. The console output was as follows:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to start status bar server. Failed to check into com.apple.UIKit.statusbarserver: unknown error code'

The reason of the exception looks pretty much the same I had to deal with some months ago (and solved in a previous post).

Well, it turns out that after the XCode upgrade, after quitting an iOS 5.x or iOS 6.x simulator instance, the SpringBoard daemon (along with many others) does not get removed, thus preventing our test target to instantiate a status bar. Interestingly enough, this behaviour does not occur when quitting an iOS 7.0 simulator.

That said, in order to fix the issue, I added the following line to the RunTests.sh script:

# Remove Springboard daemon which may be pending
launchctl remove 'com.apple.iPhoneSimulator:com.apple.SpringBoard' &> /dev/null

The complete RunTests.sh script is available at this public gist.