I use Teamcity as my build server, and I have multiple agents, and an agent has multiple Xcode versions installed on it.
Just as I started to use Xcode7.3 on my build agents, I randomly run into a build issue. When I run into this issue, I see similar entries in the build log :
[19:16:50][Step 8/38] 2016-03-31 19:16:50.017 xcodebuild[87413:1812907] [MT] DVTSDK: Skipped SDK /xcode_7_3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk; its version (10.5) is below required minimum (10.11) for the macosx platform.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.018 xcodebuild[87413:1812907] [MT] DVTSDK: Skipped SDK /xcode_7_3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk; its version (10.6) is below required minimum (10.11) for the macosx platform.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.018 xcodebuild[87413:1812907] [MT] DVTSDK: Skipped SDK /xcode_7_3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk; its version (10.7) is below required minimum (10.11) for the macosx platform.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.019 xcodebuild[87413:1812907] [MT] DVTSDK: Skipped SDK /xcode_7_3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk; its version (10.8) is below required minimum (10.11) for the macosx platform.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.019 xcodebuild[87413:1812907] [MT] DVTSDK: Skipped SDK /xcode_7_3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk; its version (10.9) is below required minimum (10.11) for the macosx platform.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.019 xcodebuild[87413:1812907] [MT] DVTSDK: Skipped SDK /xcode_7_3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk; its version (10.10) is below required minimum (10.11) for the macosx platform.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.461 xcodebuild[87413:1812925] CoreSimulator is attempting to unload a stale CoreSimulatorService job. Existing job (com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy) is from an older version and is being removed to prevent problems.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.471 xcodebuild[87413:1812925] Job com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy exists after SMJobRemove(). This can occur if running sandboxed or with an unexpected bootstrap port (eg: using sudo). jobPath: /xcode_6_3_2/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService frameworkPath: /xcode_7_3/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework
[19:16:50][Step 8/38] 2016-03-31 19:16:50.471 xcodebuild[87413:1812925] CoreSimulator is attempting to unload a stale CoreSimulatorService job. Existing job (com.apple.CoreSimulator.CoreSimulatorService.179.1.E8ttyeDeVgWK) is from an older version and is being removed to prevent problems.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.481 xcodebuild[87413:1812925] Job com.apple.CoreSimulator.CoreSimulatorService.179.1.E8ttyeDeVgWK exists after SMJobRemove(). This can occur if running sandboxed or with an unexpected bootstrap port (eg: using sudo). jobPath: /xcode_7/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService frameworkPath: /xcode_7_3/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework
[19:16:50][Step 8/38] 2016-03-31 19:16:50.496 xcodebuild[87413:1812925] CoreSimulator is attempting to unload a stale CoreSimulatorService job. Detected Xcode.app relocation or CoreSimulatorService version change. Framework path (/xcode_7_3/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework) and version (209.19) does not match existing job path (/xcode_7_2_1/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService) and version (201.3).
[19:16:50][Step 8/38] 2016-03-31 19:16:50.508 xcodebuild[87413:1812925] Job com.apple.CoreSimulator.CoreSimulatorService exists after SMJobRemove(). This can occur if running sandboxed or with an unexpected bootstrap port (eg: using sudo). jobPath: /xcode_7_2_1/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService frameworkPath: /xcode_7_3/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework
[19:16:50][Step 8/38] Not privileged to remove service.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.514 xcodebuild[87413:1812925] Failed to us launchctl asuser, falling back to not using asuser.
[19:16:50][Step 8/38] Not privileged to remove service.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.517 xcodebuild[87413:1812925] Failed to remove job com.apple.CoreSimulator.CoreSimulatorService via launchctl. Status: 256 : exited? 1,1 signaled? 0,0 stopped? 0,1
[19:16:50][Step 8/38] 2016-03-31 19:16:50.517 xcodebuild[87413:1812925] Failed to locate a valid instance of CoreSimulatorService in the bootstrap. Adding it now.
[19:16:50][Step 8/38] 2016-03-31 19:16:50.533 xcodebuild[87413:1812925] *** Assertion failure in -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreSimulator/CoreSimulator-209.19/CoreSimulator/SimServiceContext.m:536
[19:16:50][Step 8/38] ** INTERNAL ERROR: Uncaught exception **
[19:16:50][Step 8/38] Uncaught Exception: The loaded com.apple.CoreSimulator.CoreSimulatorService job does not match our expectations: pathOfLoadedJob: /xcode_7_2_1/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService, our frameworkPath: /xcode_7_3/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework
[19:16:50][Step 8/38] Stack:
[19:16:51][Step 8/38] 0 __exceptionPreprocess (in CoreFoundation)
[19:16:51][Step 8/38] 1 objc_exception_throw (in libobjc.A.dylib)
[19:16:51][Step 8/38] 2 +[NSException raise:format:arguments:] (in CoreFoundation)
[19:16:51][Step 8/38] 3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (in Foundation)
[19:16:51][Step 8/38] 4 -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid] (in CoreSimulator)
[19:16:51][Step 8/38] 5 -[SimServiceContext connect] (in CoreSimulator)
[19:16:51][Step 8/38] 6 -[SimServiceContext initWithDeveloperDir:connectionType:] (in CoreSimulator)
[19:16:51][Step 8/38] 7 __63+[SimServiceContext sharedServiceContextForDeveloperDir:error:]_block_invoke_2 (in CoreSimulator)
[19:16:51][Step 8/38] 8 _dispatch_client_callout (in libdispatch.dylib)
[19:16:51][Step 8/38] 9 _dispatch_barrier_sync_f_invoke (in libdispatch.dylib)
[19:16:51][Step 8/38] 10 +[SimServiceContext sharedServiceContextForDeveloperDir:error:] (in CoreSimulator)
[19:16:51][Step 8/38] 11 __60+[SimServiceContext(DVTAdditions) dvt_sharedServiceContext:]_block_invoke (in DVTiPhoneSimulatorRemoteClient)
[19:16:51][Step 8/38] 12 _dispatch_client_callout (in libdispatch.dylib)
[19:16:51][Step 8/38] 13 dispatch_once_f (in libdispatch.dylib)
[19:16:51][Step 8/38] 14 +[SimServiceContext(DVTAdditions) dvt_sharedServiceContext:] (in DVTiPhoneSimulatorRemoteClient)
[19:16:51][Step 8/38] 15 __42-[DVTiPhoneSimulatorLocator startLocating]_block_invoke (in IDEiOSSupportCore)
[19:16:51][Step 8/38] 16 __DVTDispatchAsync_block_invoke (in DVTFoundation)
[19:16:51][Step 8/38] 17 _dispatch_call_block_and_release (in libdispatch.dylib)
[19:16:51][Step 8/38] 18 _dispatch_client_callout (in libdispatch.dylib)
[19:16:51][Step 8/38] 19 _dispatch_root_queue_drain (in libdispatch.dylib)
[19:16:51][Step 8/38] 20 _dispatch_worker_thread3 (in libdispatch.dylib)
[19:16:51][Step 8/38] 21 _pthread_wqthread (in libsystem_pthread.dylib)
[19:16:51][Step 8/38] 22 start_wqthread (in libsystem_pthread.dylib)
[19:16:51][Step 8/38]
[19:16:51][Step 8/38] ~/build.tc/greenhorn-mac/work/f81b5b0cbda273df ~/build.tc/greenhorn-mac/work/f81b5b0cbda273df
[19:16:52][Step 8/38] ~/build.tc/greenhorn-mac/work/f81b5b0cbda273df
[19:16:52][Step 8/38]
[19:16:52][Step 8/38]
[19:16:52][Step 8/38] Process exited with code 0
I am not sure but maybe when this issue occurs, I have muliple "xcodebuild"s running at the same time on the agent with different Xcode versions.
Do you have any idea how could this issue be solved?
Thanks for your help in advance!