diff --git a/Library/Homebrew/cask/Rakefile b/Library/Homebrew/cask/Rakefile
index ec6a4a7f64b4e8e98d57dc50fdb38b3ae9f9807c..39398aa19028928005546a5cde5d55de8ce3ff07 100644
--- a/Library/Homebrew/cask/Rakefile
+++ b/Library/Homebrew/cask/Rakefile
@@ -1,8 +1,7 @@
 require "rake/testtask"
 require "rspec/core/rake_task"
 
-homebrew_repo = `brew --repository`.chomp
-$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew"))
+$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew"))
 $LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
 
 namespace :test do
diff --git a/Library/Homebrew/cask/lib/hbc/caskroom.rb b/Library/Homebrew/cask/lib/hbc/caskroom.rb
index 7bc8294e150ef118a7c455e2dccda3fc92fef4ab..644728129eeee9ce4653e3ccc2aad77c7d8b03ca 100644
--- a/Library/Homebrew/cask/lib/hbc/caskroom.rb
+++ b/Library/Homebrew/cask/lib/hbc/caskroom.rb
@@ -3,7 +3,7 @@ module Hbc
     module_function
 
     def migrate_caskroom_from_repo_to_prefix
-      repo_caskroom = Hbc.homebrew_repository.join("Caskroom")
+      repo_caskroom = HOMEBREW_REPOSITORY.join("Caskroom")
       return if Hbc.caskroom.exist?
       return unless repo_caskroom.directory?
 
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index 4c5bf98e6608cd2d5c588dabe59c32d44164b7e2..84d8e1ebcf62ee1c7f189634d63a1d9cde9995d4 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -8,9 +8,9 @@ module Hbc
         ohai "Ruby Path:", render_with_none_as_error(RbConfig.ruby)
         # TODO: consider removing most Homebrew constants from doctor output
         ohai "Homebrew Version:", render_with_none_as_error(homebrew_version)
-        ohai "Homebrew Executable Path:", render_with_none_as_error(Hbc.homebrew_executable)
+        ohai "Homebrew Executable Path:", render_with_none_as_error(HOMEBREW_BREW_FILE)
         ohai "Homebrew Cellar Path:", render_with_none_as_error(homebrew_cellar)
-        ohai "Homebrew Repository Path:", render_with_none_as_error(homebrew_repository)
+        ohai "Homebrew Repository Path:", render_with_none_as_error(HOMEBREW_REPOSITORY)
         ohai "Homebrew Origin:", render_with_none_as_error(homebrew_origin)
         ohai "Homebrew-Cask Version:", render_with_none_as_error(Hbc.full_version)
         ohai "Homebrew-Cask Install Location:", render_install_location
@@ -47,7 +47,7 @@ module Hbc
       def self.homebrew_origin
         homebrew_origin = notfound_string
         begin
-          Dir.chdir(homebrew_repository) do
+          Dir.chdir(HOMEBREW_REPOSITORY) do
             homebrew_origin = SystemCommand.run("/usr/bin/git",
                                                      args:         %w[config --get remote.origin.url],
                                                      print_stderr: false).stdout.strip
@@ -63,10 +63,6 @@ module Hbc
         homebrew_origin
       end
 
-      def self.homebrew_repository
-        homebrew_constants("repository")
-      end
-
       def self.homebrew_cellar
         homebrew_constants("cellar")
       end
@@ -76,9 +72,7 @@ module Hbc
       end
 
       def self.homebrew_taps
-        @homebrew_taps ||= if homebrew_repository.respond_to?(:join)
-          homebrew_repository.join("Library", "Taps")
-        end
+        Tap::TAP_DIRECTORY
       end
 
       def self.homebrew_constants(name)
@@ -86,7 +80,7 @@ module Hbc
         return @homebrew_constants[name] if @homebrew_constants.key?(name)
         @homebrew_constants[name] = notfound_string
         begin
-          @homebrew_constants[name] = SystemCommand.run!(Hbc.homebrew_executable,
+          @homebrew_constants[name] = SystemCommand.run!(HOMEBREW_BREW_FILE,
                                                          args:         ["--#{name}"],
                                                          print_stderr: false)
                                                    .stdout
diff --git a/Library/Homebrew/cask/lib/hbc/cli/update.rb b/Library/Homebrew/cask/lib/hbc/cli/update.rb
index 1d6ed2af547712f584a0431dc5551ac882489e24..86d02bb55b64f9136e35085c92f593c47551b41f 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/update.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/update.rb
@@ -2,8 +2,8 @@ module Hbc
   class CLI
     class Update < Base
       def self.run(*_ignored)
-        result = SystemCommand.run(Hbc.homebrew_executable,
-                                   args: %w[update])
+        result = SystemCommand.run(HOMEBREW_BREW_FILE,
+                                   args: ["update"])
         # TODO: separating stderr/stdout is undesirable here.
         #       Hbc::SystemCommand should have an option for plain
         #       unbuffered output.
diff --git a/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb b/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb
index 9dd9abab1c3d6adc3d240f7fbae916dfcfeaf449..402574456aebf7ce103eadeba10c33676447b370 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb
@@ -31,7 +31,7 @@ module Hbc
 
       def files_in_usr_local
         localpath = "/usr/local"
-        return unless Hbc.homebrew_prefix.to_s.downcase.start_with?(localpath)
+        return unless HOMEBREW_PREFIX.to_s.downcase.start_with?(localpath)
         puts <<-EOS.undent
           Cask #{@cask} installs files under "#{localpath}". The presence of such
           files can cause warnings when running "brew doctor", which is considered
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 0c50e37573269962398ad3842fc00ba12b52177f..183d1f14bae60334ec10ffa733700b3b6c7ddcde 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -188,13 +188,13 @@ module Hbc
       ohai "Installing Formula dependencies from Homebrew"
       @cask.depends_on.formula.each do |dep_name|
         print "#{dep_name} ... "
-        installed = @command.run(Hbc.homebrew_executable,
+        installed = @command.run(HOMEBREW_BREW_FILE,
                                  args:         ["list", "--versions", dep_name],
                                  print_stderr: false).stdout.include?(dep_name)
         if installed
           puts "already installed"
         else
-          @command.run!(Hbc.homebrew_executable,
+          @command.run!(HOMEBREW_BREW_FILE,
                         args: ["install", dep_name])
           puts "done"
         end
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index 8f6c028eca2d39cdf8c36170fb760e8e652997d6..7a0bde1b06dda3646e9b2d8a9592465416947b44 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -10,7 +10,7 @@ module Hbc
       end
 
       def default_caskroom
-        @default_caskroom ||= homebrew_prefix.join("Caskroom")
+        @default_caskroom ||= HOMEBREW_PREFIX.join("Caskroom")
       end
 
       def caskroom
@@ -39,11 +39,11 @@ module Hbc
       end
 
       def legacy_cache
-        @legacy_cache ||= homebrew_cache.join("Casks")
+        @legacy_cache ||= HOMEBREW_CACHE.join("Casks")
       end
 
       def cache
-        @cache ||= homebrew_cache.join("Cask")
+        @cache ||= HOMEBREW_CACHE.join("Cask")
       end
 
       attr_writer :appdir
@@ -91,7 +91,7 @@ module Hbc
       attr_writer :binarydir
 
       def binarydir
-        @binarydir ||= homebrew_prefix.join("bin")
+        @binarydir ||= HOMEBREW_PREFIX.join("bin")
       end
 
       attr_writer :input_methoddir
@@ -179,36 +179,6 @@ module Hbc
       def x11_libpng
         @x11_libpng ||= [Pathname.new("/opt/X11/lib/libpng.dylib"), Pathname.new("/usr/X11/lib/libpng.dylib")]
       end
-
-      def homebrew_cache
-        @homebrew_cache ||= HOMEBREW_CACHE
-      end
-
-      def homebrew_cache=(path)
-        @homebrew_cache = path ? Pathname.new(path) : path
-      end
-
-      def homebrew_executable
-        @homebrew_executable ||= HOMEBREW_BREW_FILE
-      end
-
-      def homebrew_prefix
-        # where Homebrew links
-        @homebrew_prefix ||= HOMEBREW_PREFIX
-      end
-
-      def homebrew_prefix=(path)
-        @homebrew_prefix = path ? Pathname.new(path) : path
-      end
-
-      def homebrew_repository
-        # where Homebrew's .git dir is found
-        @homebrew_repository ||= HOMEBREW_REPOSITORY
-      end
-
-      def homebrew_repository=(path)
-        @homebrew_repository = path ? Pathname.new(path) : path
-      end
     end
   end
 end
diff --git a/Library/Homebrew/cask/spec/spec_helper.rb b/Library/Homebrew/cask/spec/spec_helper.rb
index 1e41e3de438b92ddda379460473816b273230db2..7e72a2cee5f358d05a5d0611e34f142416c36757 100644
--- a/Library/Homebrew/cask/spec/spec_helper.rb
+++ b/Library/Homebrew/cask/spec/spec_helper.rb
@@ -29,7 +29,7 @@ end
 # create and override default directories
 Hbc.appdir = Pathname.new(TEST_TMPDIR).join("Applications").tap(&:mkpath)
 Hbc.cache.mkpath
-Hbc.caskroom.mkpath
+Hbc.caskroom = Hbc.default_caskroom.tap(&:mkpath)
 Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap|
   # link test casks
   FileUtils.mkdir_p tap.path.dirname
diff --git a/Library/Homebrew/cask/test/support/fake_dirs.rb b/Library/Homebrew/cask/test/support/fake_dirs.rb
index f8e36bbbb27a7aa8dacb207a7fcb9d09ea8f1d9d..ea7acc68563f4a6a1c668e02adac35c721d6d15f 100644
--- a/Library/Homebrew/cask/test/support/fake_dirs.rb
+++ b/Library/Homebrew/cask/test/support/fake_dirs.rb
@@ -8,7 +8,7 @@ module FakeDirHooks
     @canned_dirs = {}
 
     DIRS.each do |dir_name|
-      dir = Hbc.homebrew_prefix.join("#{dir_name}-#{Time.now.to_i}-#{rand(1024)}")
+      dir = HOMEBREW_PREFIX.join("#{dir_name}-#{Time.now.to_i}-#{rand(1024)}")
       dir.mkpath
       Hbc.send("#{dir_name}=", dir)
       @canned_dirs[:dir_name] = dir
diff --git a/Library/Homebrew/cask/test/test_helper.rb b/Library/Homebrew/cask/test/test_helper.rb
index 85024aae86d142292b22828e934cb4d57ddedd45..73459cb25c61f15ba64a16494a20f0620d3ad8a8 100644
--- a/Library/Homebrew/cask/test/test_helper.rb
+++ b/Library/Homebrew/cask/test/test_helper.rb
@@ -41,8 +41,10 @@ module Hbc
   class TestCask < Cask; end
 end
 
+# create and override default directories
+Hbc.appdir = Pathname.new(TEST_TMPDIR).join("Applications").tap(&:mkpath)
 Hbc.cache.mkpath
-Hbc.caskroom.mkpath
+Hbc.caskroom = Hbc.default_caskroom.tap(&:mkpath)
 Hbc.default_tap = Tap.fetch("caskroom", "test").tap do |tap|
   # link test casks
   FileUtils.mkdir_p tap.path.dirname