With bash 4.4:
$ ./build.sh
$ echo $?
69
This is a problem because to use Realm at all, you at least need build.sh download-core or build.sh cocoapods-setup.
The issue seems to be in the way we expand -debug commands:
# Use Debug config if command ends with -debug, otherwise default to Release
case "$COMMAND" in
*-debug)
COMMAND="${COMMAND%-debug}"
CONFIGURATION="Debug"
;;
*) CONFIGURATION=${CONFIGURATION:-Release}
esac
export CONFIGURATION
based on my limited debugging putting print statements at various parts of the script 馃槄
build.sh is executed via /bin/sh if you run it as ./build.sh, so it should always be using the system version of Bash. That's been Bash 3.2 for some time now.
A different version of Bash can only be used if you're invoking it as sh build.sh or bash build.sh and happen to have a different version of sh or bash in your PATH ahead of the system version. It's not clear to me that there's any reason to support this scenario.
re-installing bash worked.
Got this issue again after installing Xcode 8.2 beta 2, and the solution was to accept the new license: sudo xcodebuild -license accept.