diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md
index 9281f68e6ccdff93b09b3e382aab6f194454e909..d5440189ff4d1528d448be613c81ba9318f36e6e 100644
--- a/Library/Contributions/manpages/brew.1.md
+++ b/Library/Contributions/manpages/brew.1.md
@@ -275,6 +275,10 @@ Some sample commands ship with Homebrew and are enabled by default.
     This issue typically occurs when using FileVault or custom SSD
     configurations.
 
+  * HOMEBREW\_USE\_GCC:
+    If set, instructs Homebrew to use gcc, even if the system default
+    is currently set to LLVM.
+
   * HOMEBREW\_USE\_LLVM:
     If set, instructs Homebrew to use the LLVM front-ends to the GCC
     compilers.
diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb
index 07623171dc553e93657607aeb1c08ba3e580a7db..2f6e421a0b42cdf918a206cb18a7b06d9393b903 100644
--- a/Library/Homebrew/cmd/--env.rb
+++ b/Library/Homebrew/cmd/--env.rb
@@ -10,6 +10,7 @@ module Homebrew extend self
 
   def dump_build_env env
     puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm'
+    puts "\"--use-gcc\" was specified" if ARGV.include? '--use-gcc'
 
     %w[ CC CXX LD ].each do |k|
       value = env[k]
@@ -24,7 +25,7 @@ module Homebrew extend self
     end
 
     %w[ CFLAGS CXXFLAGS CPPFLAGS LDFLAGS MACOSX_DEPLOYMENT_TARGET MAKEFLAGS PKG_CONFIG_PATH
-        HOMEBREW_DEBUG HOMEBREW_VERBOSE HOMEBREW_USE_LLVM HOMEBREW_SVN ].each do |k|
+        HOMEBREW_DEBUG HOMEBREW_VERBOSE HOMEBREW_USE_GCC HOMEBREW_USE_LLVM HOMEBREW_SVN ].each do |k|
       value = env[k]
       puts "#{k}: #{value}" if value
     end
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 7ea616d7636424028063e88edfc25f907c0da2fb..9cbc9b8324580151696181f0836cb026a275051f 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -147,6 +147,9 @@ def check_cc_symlink
         To force Homebrew to use LLVM, you can set the "HOMEBREW_LLVM" environmental
         variable, or pass "--use-llvm" to "brew install".
 
+        To force Homebrew to use gcc, you can set the "HOMEBREW_GCC" environmental
+        variable, or pass "--use-gcc" to "brew install".
+
       EOS
     end
 end
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index bb2bbd54424adae546a5eebb1d51366e2df1e2a9..fc4dc96aef41348e68cd66b30acfd3cf6b2fdc74 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -24,6 +24,10 @@ module HomebrewEnvExtension
       self['CC'] = "#{xcode_path}/usr/bin/llvm-gcc"
       self['CXX'] = "#{xcode_path}/usr/bin/llvm-g++"
       cflags = ['-O4'] # link time optimisation baby!
+    elsif MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_GCC'] or ARGV.include? '--use-gcc')
+      self['CC'] = '/usr/bin/gcc'
+      self['CXX'] = '/usr/bin/g++'
+      cflags = ['-O3']
     else
       # If these aren't set, many formulae fail to build
       self['CC'] = '/usr/bin/cc'
diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1
index 5e40702fc9d8728a1534f49133413ede3cb73637..f5979e593660039470f61e6e53f81dbe8b7d672c 100644
--- a/share/man/man1/brew.1
+++ b/share/man/man1/brew.1
@@ -298,6 +298,10 @@ If set, instructs Homebrew to use \fBHOMEBREW_TEMP\fR as the temporary folder fo
 This issue typically occurs when using FileVault or custom SSD configurations\.
 .
 .TP
+HOMEBREW_USE_GCC
+If set, instructs Homebrew to use gcc, even if the system default is currently set to LLVM\.
+.
+.TP
 HOMEBREW_USE_LLVM
 If set, instructs Homebrew to use the LLVM front\-ends to the GCC compilers\.
 .