diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 147676b3c2..c56919949b 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -40,7 +40,13 @@ module MacOS extend self end def dev_tools_path - @dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make" + @dev_tools_path ||= \ + if File.exist? MacOS::CLT::STANDALONE_PKG_PATH and + File.exist? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin/cc" and + File.exist? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin/make" + # In 10.9 the CLT moved from /usr into /Library/Developer/CommandLineTools. + Pathname.new "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin" + elsif File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make" # probably a safe enough assumption (the unix way) Pathname.new "/usr/bin" # Note that the exit status of system "xcrun foo" isn't always accurate diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 3fa7d62aea..202567eb4d 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -154,16 +154,16 @@ end module MacOS::CLT extend self STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" + STANDALONE_PKG_PATH = Pathname.new("/Library/Developer/CommandLineTools") - # This is true ift he standard UNIX tools are present under /usr. For - # Xcode < 4.3, this is the standard location. Otherwise, it means that - # the user has installed the "Command Line Tools for Xcode" package. - # TODO: handle 10.9 CLT which has headers under: - # /Library/Developer/CommandLineTools/usr/include + # This is true if the standard UNIX tools are present in the expected location. For + # Mavericks and above this is /Library/Developer/CommandLineTools otherwise it is /usr. + # For Xcode < 4.3, this is the standard location. Otherwise, it means that the user has + # installed the "Command Line Tools for Xcode" package. def installed? - return false if MacOS.version > :mountain_lion - MacOS.dev_tools_path == Pathname.new("/usr/bin") and - File.directory? "/usr/include" + (MacOS.dev_tools_path == Pathname.new("#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin") \ + and File.directory? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/include") or + (MacOS.dev_tools_path == Pathname.new("/usr/bin") and File.directory? "/usr/include") end def latest_version?