diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index f105eede4eb9b446907148dac4e9a84fc444a899..56cfbc24fed18b8df4ffec803fab2d1c1ce9036a 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -218,15 +218,9 @@ module Homebrew raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable_real? || HOMEBREW_PREFIX.to_s == "/usr/local" end - def check_xcode + def check_development_tools checks = Diagnostic::Checks.new - %w[ - check_for_unsupported_osx - check_for_bad_install_name_tool - check_for_installed_developer_tools - check_xcode_license_approved - check_for_osx_gcc_installer - ].each do |check| + checks.all_development_tools_checks.each do |check| out = checks.send(check) opoo out unless out.nil? end @@ -252,7 +246,7 @@ module Homebrew def perform_preinstall_checks check_ppc check_writable_install_location - check_xcode if MacOS.has_apple_developer_tools? + check_development_tools if DevelopmentTools.installed? check_cellar end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 8bce6355941c04aebafb33ff30b04a1f79d6bcb5..020be905366bedb9bc52e25c1268b9f6b74d1096 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -85,6 +85,21 @@ module Homebrew end ############# END HELPERS + def all_development_tools_checks + %w[ + check_for_installed_developer_tools + ] + end + + def check_for_installed_developer_tools + return if DevelopmentTools.installed? + + <<-EOS.undent + No developer tools installed. + Install clang or gcc. + EOS + end + # See https://github.com/Homebrew/legacy-homebrew/pull/9986 def check_path_for_trailing_slashes all_paths = ENV["PATH"].split(File::PATH_SEPARATOR) diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 31830e4afde33735c4616dd68bcaee1236deac2b..37c1efdc2f1debfe540badf62aecf0acd81760e1 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -1,6 +1,16 @@ module Homebrew module Diagnostic class Checks + def all_development_tools_checks + %w[ + check_for_unsupported_osx + check_for_bad_install_name_tool + check_for_installed_developer_tools + check_xcode_license_approved + check_for_osx_gcc_installer + ] + end + def check_for_unsupported_osx return if ARGV.homebrew_developer?