How to use a pipe in a script optionally
Just use cat as a no-op if xcpretty is not installed:

XCPRETTY="xcpretty"
which xcpretty || XCPRETTY="cat"
xcodebuild archive ....... | eval $XCPRETTY || exit 1