diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index a0491a2558..2854c82b15 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -317,7 +317,7 @@ module MacOS extend self @xcode_prefix ||= begin path = `/usr/bin/xcode-select -print-path 2>/dev/null`.chomp path = Pathname.new path - if path.directory? and path.absolute? + if $?.success? and path.directory? and path.absolute? path elsif File.directory? '/Developer' # we do this to support cowboys who insist on installing @@ -343,9 +343,12 @@ module MacOS extend self def xcode_version @xcode_version ||= begin + # Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus + raise if `xcode-select -print-path 2>/dev/null`.chomp == "/" + raise unless system "/usr/bin/which -s xcodebuild" - `xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/ - raise if $1.nil? + `xcodebuild -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ + raise if $1.nil? or not $?.success? $1 rescue # for people who don't have xcodebuild installed due to using