We launch the simulator before running xcodebuild (with code coverage). We are recently seeing the following command fail to launch the simulator, but when it does (grrr… circleci inconsistencies) you will avoid the timeout issue.
Something like (change for whatever simulator you need):
printf "Closing any open instances of the iphone simulator...\n"
killall "Simulator"
printf "Determining latest iOS simulator...\n"
latest_ios=$(xcodebuild -showsdks | grep -Eo "iphonesimulator(.+)" | tail -1)
latest_ios=${latest_ios##iphonesimulator}
printf "Detected latest iOS simulator version: ${latest_ios}\n"
printf "Pre-Launching iphone simulator for iPhone 6 (${latest_ios})\n"
simulator_id=$(xcrun instruments -s | grep -Eo "iPhone 6 \(${latest_ios}\) \[.*\]" | grep -Eo "\[.*\]" | sed "s/^\[\(.*\)\]$/\1/")
open -b com.apple.iphonesimulator --args -CurrentDeviceUDID $simulator_id
RETVALUE=$?
if [ "$RETVALUE" != "0" ]; then
printf "Something went wrong when attempting to launch the simulator for iPhone 6 (${latest_ios})\n"
exit 1;
fi
printf "Simulator launched for iPhone 6 (${latest_ios})\nStarting build...\n"