diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 83fad256f7..37939264d8 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -27,25 +27,11 @@ module OS @locate[key] = if File.executable?(path = "/usr/bin/#{tool}") Pathname.new path # Homebrew GCCs most frequently; much faster to check this before xcrun - # This also needs to be queried if xcrun won't work, e.g. CLT-only elsif File.executable?(path = "#{HOMEBREW_PREFIX}/bin/#{tool}") Pathname.new path else - # If the tool isn't in /usr/bin or from Homebrew, - # then we first try to use xcrun to find it. - # If it's not there, or xcode-select is misconfigured, we have to - # look in dev_tools_path, and finally in xctoolchain_path, because the - # tools were split over two locations beginning with Xcode 4.3+. - xcrun_path = begin - path = `/usr/bin/xcrun -find #{tool} 2>/dev/null`.chomp - # If xcrun finds a superenv tool then discard the result. - path unless path.include?("Library/ENV") - end - - paths = %W[#{xcrun_path} - #{dev_tools_path}/#{tool} - #{xctoolchain_path}/usr/bin/#{tool}] - paths.map { |p| Pathname.new(p) }.find { |p| p.executable? } + path = `/usr/bin/xcrun -no-cache -find #{tool} 2>/dev/null`.chomp + Pathname.new(path) if File.executable?(path) end end end