diff --git a/Library/Homebrew/shims/mac/super/xcrun b/Library/Homebrew/shims/mac/super/xcrun index 7f5e95dec0..a74834fd66 100755 --- a/Library/Homebrew/shims/mac/super/xcrun +++ b/Library/Homebrew/shims/mac/super/xcrun @@ -4,14 +4,14 @@ # it and attempts to avoid these issues. # These could be used in conjunction with `--sdk` which ignores SDKROOT. -if [[ "$*" =~ (^| )-?-show-sdk-(path|version|build) ]]; then +if [[ "$*" =~ (^| )-?-show-sdk-(path|version|build) && -n "$HOMEBREW_DEVELOPER_DIR" ]]; then export DEVELOPER_DIR=$HOMEBREW_DEVELOPER_DIR else # Some build tools set DEVELOPER_DIR, so discard it unset DEVELOPER_DIR fi -if [ -z "$SDKROOT" ]; then +if [[ -z "$SDKROOT" && -n "$HOMEBREW_SDKROOT" ]]; then export SDKROOT=$HOMEBREW_SDKROOT fi