diff --git a/Library/Homebrew/config.rb b/Library/Homebrew/config.rb
index 6da8c481ee4a6380b2223e80427d45aafb823a7d..4a6ad2f2cde21a193c52d1a98579384942050bd3 100644
--- a/Library/Homebrew/config.rb
+++ b/Library/Homebrew/config.rb
@@ -39,6 +39,7 @@ HOMEBREW_PREFIX = Pathname.new(ENV["HOMEBREW_PREFIX"])
 HOMEBREW_REPOSITORY = Pathname.new(ENV["HOMEBREW_REPOSITORY"])
 
 HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"])
+HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY/"ENV"
 HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions"
 
 # Where we store built products
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index 8bfc5ce570e3e39eb6b073f670e5060ce075bff8..b3b91dc477f5013dbc2b06bdd638f5d7e5375545 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -77,7 +77,7 @@ module Stdenv
     paths = []
     paths << "#{HOMEBREW_PREFIX}/lib/pkgconfig"
     paths << "#{HOMEBREW_PREFIX}/share/pkgconfig"
-    paths << "#{HOMEBREW_LIBRARY}/ENV/pkgconfig/#{MacOS.version}"
+    paths << "#{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}"
     paths << "/usr/lib/pkgconfig"
     paths.select { |d| File.directory? d }.join(File::PATH_SEPARATOR)
   end
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index c2401602f3a51c7d6b2174c99607ae9fb0176308..e4eb86cdf0c23ff6f112a2fa32e41fb527d788b0 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -28,7 +28,7 @@ module Superenv
   def self.bin
     return unless MacOS.has_apple_developer_tools?
 
-    bin = (HOMEBREW_REPOSITORY/"Library/ENV").subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
+    bin = HOMEBREW_ENV_PATH.subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
     bin.realpath unless bin.nil?
   end
 
@@ -150,7 +150,7 @@ module Superenv
   end
 
   def determine_pkg_config_libdir
-    paths = %W[/usr/lib/pkgconfig #{HOMEBREW_LIBRARY}/ENV/pkgconfig/#{MacOS.version}]
+    paths = %W[/usr/lib/pkgconfig #{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}]
     paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11?
     paths.to_path_s
   end
diff --git a/Library/Homebrew/test/lib/config.rb b/Library/Homebrew/test/lib/config.rb
index cf95785445617241ca720d627c91298ca9ca53f0..f6e601d529c192db2b2f1c271f43a48e99637183 100644
--- a/Library/Homebrew/test/lib/config.rb
+++ b/Library/Homebrew/test/lib/config.rb
@@ -14,6 +14,7 @@ HOMEBREW_PREFIX        = Pathname.new(TEST_TMPDIR).join("prefix")
 HOMEBREW_REPOSITORY    = HOMEBREW_PREFIX
 HOMEBREW_LIBRARY       = HOMEBREW_REPOSITORY+"Library"
 HOMEBREW_LIBRARY_PATH  = Pathname.new(File.expand_path("../../..", __FILE__))
+HOMEBREW_ENV_PATH      = HOMEBREW_LIBRARY_PATH.parent+"ENV"
 HOMEBREW_LOAD_PATH     = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":")
 HOMEBREW_CACHE         = HOMEBREW_PREFIX.parent+"cache"
 HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache"
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index d0c1d500dc99b6d770bd455491f63068652f66b0..8b76dee2c83936c08e255767048532a2be486336 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -6,7 +6,7 @@ require "global"
 require "formulary"
 
 # Test environment setup
-%w[ENV Formula].each { |d| HOMEBREW_LIBRARY.join(d).mkpath }
+HOMEBREW_LIBRARY.join("Formula").mkpath
 %w[cache formula_cache cellar logs].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
 
 # Test fixtures and files can be found relative to this path
diff --git a/Library/brew.rb b/Library/brew.rb
index 8675ab881f4af571e4b05d3c0f2b7230caced485..cf89cb86d5afa35248f1b0d7b671177ebe50466a 100644
--- a/Library/brew.rb
+++ b/Library/brew.rb
@@ -50,7 +50,7 @@ begin
   end
 
   # Add SCM wrappers.
-  ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_LIBRARY}/ENV/scm"
+  ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_ENV_PATH}/scm"
 
   if cmd
     internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd)