diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 9f9579109da9f115eec21b411d9f3f5697abab47..b1ff5d9cfecb225ae2a0944c98f57de532f1be57 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -90,8 +90,7 @@ module HomebrewEnvExtension
     @compiler = :gcc
 
     raise "GCC could not be found" if args[:force] and not File.exist? ENV['CC'] \
-                                   or (File.symlink? ENV['CC'] \
-                                   and File.readlink(ENV['CC']) =~ /llvm/)
+                                   or (Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/)
   end
   alias_method :gcc_4_2, :gcc