aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 4ef0a5a67..b335c45ea 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -378,6 +378,14 @@ module MacOS extend self
def xcode_version
@xcode_version ||= begin
+ # this shortcut makes xcode_version work for people who don't realise you
+ # need to install the CLI tools
+ xcode43build = "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild"
+ if File.file? xcode43build
+ `#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
+ return $1 if $1
+ end
+
# Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus
raise if `xcode-select -print-path 2>/dev/null`.chomp == "/"
@@ -389,8 +397,8 @@ module MacOS extend self
# For people who's xcode-select is unset, or who have installed
# xcode-gcc-installer or whatever other combinations we can try and
# supprt. See https://github.com/mxcl/homebrew/wiki/Xcode
- case nil
- when 0..2063 then "3.1.0"
+ case llvm_build_version.to_i
+ when 1..2063 then "3.1.0"
when 2064..2065 then "3.1.4"
when 2366..2325
# we have no data for this range so we are guessing
@@ -405,7 +413,9 @@ module MacOS extend self
"4.0"
else
case (clang_version.to_f * 10).to_i
- when 0..14
+ when 0
+ "dunno"
+ when 1..14
"3.2.2"
when 15
"3.2.4"