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

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:

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 script:

The complete script is available at this public gist.