[darwin] added better error checks to build script