Appium hangs at WebDriverAgent initiation

I build Appium from source yesterday. When I try to run a test appium hangs on the WebDriverAgent initiation part:

[debug] [XCUITest] Beginning test with command 'xcodebuild build test -project /Users/<user>/Development/github/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=<deviceID> -configuration Debug' in directory '/Users/<user>/Development/github/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/<user>/Library/Developer/Xcode/DerivedData/WebDriverAgent-cwvjemazwndqbrgilnqpbxpkfudf/Logs/Test/B16FF8CF-B922-477D-A3AD-D61B635118F5/Session-WebDriverAgentRunner-2016-12-02_110050-KJHqHD.log
[debug] [WebDriverAgent] Device: Dec  2 11:00:50 Roberts-iPad XCTRunner[318] <Notice>: Running tests...
[debug] [WebDriverAgent] Device: Dec  2 11:00:51 Roberts-iPad XCTRunner[318] <Notice>: Continuing to run tests in the background with task ID 1

The fix that works for me is removing the WebDriverAgent build files before running the test:

rm -rf /Users/<user>/Library/Developer/Xcode/DerivedData/WebDriverAgent-eoyoecqmiqfeodgstkwbxkfyagll

This will make the first time I run my test work and go pass the hanging point. However, if I try to run it again, the test hangs at the same place.

Can I fix this so that I don’t have to remove the WebDriverAgent build folder every time appium tries to build and run it?

PS: I don’t know what information is relevant for this problem but if able I will be happy to provide it.