diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 3471bf1ee19144a4dc1fb092a466818fc766c07f..720cb4fe62298626df91fdb96cadc962ffd37861 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -437,7 +437,7 @@ def check_xcode_prefix_exists end def check_xcode_select_path - if not MacOS::CLT.installed? and not File.file? "#{MacOS::Xcode.folder}/usr/bin/xcodebuild" + if not MacOS::CLT.installed? and not File.file? "#{MacOS.active_developer_dir}/usr/bin/xcodebuild" path = MacOS.app_with_bundle_id(MacOS::Xcode::V4_BUNDLE_ID, MacOS::Xcode::V3_BUNDLE_ID) path = '/Developer' if path.nil? or not path.directory? <<-EOS.undent diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 6ed35440d474e395d2bdbb121c301c1c9a5e5b41..c2dd1a1f6019ddcc02e05078db5bc5cd2fe3e35a 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -36,6 +36,10 @@ module OS end end + def active_developer_dir + @active_developer_dir ||= `xcode-select -print-path 2>/dev/null`.strip + end + def dev_tools_prefix dev_tools_path.parent.parent end diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 4c79e39659b4dfa6d3b3397182484c494d653bfe..284214b26cdfa964a19cd6279ab35bb567f761e5 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -7,14 +7,6 @@ module OS V3_BUNDLE_ID = "com.apple.Xcode" V4_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app") - # Locate the "current Xcode folder" via xcode-select. See: - # man xcode-select - # TODO Should this be moved to OS::Mac? As of 10.9 this is referred to - # as the "developer directory", and be either a CLT or Xcode instance. - def folder - @folder ||= `xcode-select -print-path 2>/dev/null`.strip - end - def latest_version case MacOS.version when "10.4" then "2.5" @@ -43,7 +35,7 @@ module OS def prefix @prefix ||= begin - path = Pathname.new(folder) + path = Pathname.new(MacOS.active_developer_dir) if path != CLT::MAVERICKS_PKG_PATH and path.absolute? \ and File.executable? "#{path}/usr/bin/make" path diff --git a/Library/brew.rb b/Library/brew.rb index 5927193405be4c0d70b381ababf8432b50dd6f7f..ae9b37d6bbe3b93b96b3d82bc930b9587e0c1408 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -34,7 +34,7 @@ end # Check for bad xcode-select before anything else, because `doctor` and # many other things will hang # Note that this bug was fixed in 10.9 -if OS.mac? && MacOS.version < :mavericks && MacOS::Xcode.folder == "/" +if OS.mac? && MacOS.version < :mavericks && MacOS.active_developer_dir == "/" odie <<-EOS.undent Your xcode-select path is currently set to '/'. This causes the `xcrun` tool to hang, and can render Homebrew unusable.