diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 37d4c7779f..e1829e32a6 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -57,7 +57,14 @@ module Stdenv # Os is the default Apple uses for all its stuff so let's trust them define_cflags "-Os #{SAFE_CFLAGS_FLAGS}" - send(compiler) + begin + send(compiler) + rescue CompilerSelectionError + # We don't care if our compiler fails to build the formula during `brew test`. + raise unless testing_formula + + send(DevelopmentTools.default_compiler) + end return unless cc&.match?(GNU_GCC_REGEXP)