aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorElliot Saba2016-06-08 05:53:10 -0700
committerMartin Afanasjew2016-06-08 14:53:10 +0200
commit2ca6dbbe9d94b5d295f46f7a1d3a12ade3aa3f08 (patch)
treec84ae6b68bebbea19c4ff0d5b0064713302ca1f1 /Library
parent8d64b6a02d78811f50d5f747ce10df09d54b4791 (diff)
downloadbrew-2ca6dbbe9d94b5d295f46f7a1d3a12ade3aa3f08.tar.bz2
brew.rb: Don't ask `xcrun` for output if no CLT is installed (#334)
This avoids `xcrun` popups when installing Homebrew on a non-Xcode non-CLT machine.
Diffstat (limited to 'Library')
-rw-r--r--Library/brew.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/Library/brew.sh b/Library/brew.sh
index f65b7f63d..8d55601c0 100644
--- a/Library/brew.sh
+++ b/Library/brew.sh
@@ -137,7 +137,8 @@ export HOMEBREW_USER_AGENT_CURL
if [[ -n "$HOMEBREW_OSX" ]]
then
- if [[ "$('/usr/bin/xcode-select' --print-path)" = "/" ]]
+ XCODE_SELECT_PATH=$('/usr/bin/xcode-select' --print-path 2>/dev/null)
+ if [[ "$XCODE_SELECT_PATH" = "/" ]]
then
odie <<EOS
Your xcode-select path is currently set to '/'.
@@ -149,15 +150,20 @@ Otherwise, you should:
EOS
fi
- XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)"
- XCRUN_STATUS="$?"
-
- if [[ "$XCRUN_STATUS" -ne 0 && "$XCRUN_OUTPUT" = *license* ]]
+ # Don't check xcrun if Xcode and the CLT aren't installed, as that opens
+ # a popup window asking the user to install the CLT
+ if [[ -n "$XCODE_SELECT_PATH" ]]
then
- odie <<EOS
+ XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)"
+ XCRUN_STATUS="$?"
+
+ if [[ "$XCRUN_STATUS" -ne 0 && "$XCRUN_OUTPUT" = *license* ]]
+ then
+ odie <<EOS
You have not agreed to the Xcode license. Please resolve this by running:
sudo xcodebuild -license
EOS
+ fi
fi
fi