Xcode 5, XCTests, and Build Agents as LaunchDaemons

I'm not sure if this is the right venue to place this but I'd just like to share something I've spent hours on that I could not find documented elsewhere.

The issue:

I was attempting to run tests via a Build Configuration within TeamCity. I could not get it to work. I had my build agent (Mac mini) set up to be launched as a launch daemon (per the documentation). I was either seeing no tests being run (agent builds the test target but didn't run the tests and marks that step as successful) or xcodebuild would hang if I was logged in as the same user I had the launch daemon set to launch the build agent as.

The solution:

So after a long time of investigating, I realized that running xctests requires an interactive session (aka a logged in user). For my purposes, a login script that launched the build agent did the trick.

I'm curious as to whether anyone has any other solutions.

Please sign in to leave a comment.