diff --git a/Library/brew.rb b/Library/Homebrew/brew.rb
similarity index 98%
rename from Library/brew.rb
rename to Library/Homebrew/brew.rb
index 9110d5db03989aeda005adea7506389d3bbde7be..9d29f43962e14c492e945f0d7f95802a0390e52a 100644
--- a/Library/brew.rb
+++ b/Library/Homebrew/brew.rb
@@ -1,7 +1,7 @@
 std_trap = trap("INT") { exit! 130 } # no backtrace thanks
 
 require "pathname"
-HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew")
+HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
 $:.unshift(HOMEBREW_LIBRARY_PATH.to_s)
 require "global"
 
diff --git a/Library/brew.sh b/Library/Homebrew/brew.sh
similarity index 99%
rename from Library/brew.sh
rename to Library/Homebrew/brew.sh
index 5dd1ce63084515ed769f4ad04bac8fb573f46b4d..dd9e54e7e6639e19cc5967a44b1089f820911cbb 100644
--- a/Library/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -245,5 +245,5 @@ else
 
   # Unshift command back into argument list (unless argument list was empty).
   [[ "$HOMEBREW_ARG_COUNT" -gt 0 ]] && set -- "$HOMEBREW_COMMAND" "$@"
-  { update-preinstall; exec "$HOMEBREW_RUBY_PATH" -W0 "$HOMEBREW_LIBRARY/brew.rb" "$@"; }
+  { update-preinstall; exec "$HOMEBREW_RUBY_PATH" -W0 "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; }
 fi
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 49a15864f76c27db92d32465a1d32ad3aeabfdc0..e9ad69c0648e2f7800fdb2c02fcc4b24a7960e7d 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -9,7 +9,7 @@
 # shellcheck source=/dev/null
 source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
 
-# Replaces the function in Library/brew.sh to cache the Git executable to
+# Replaces the function in Library/Homebrew/brew.sh to cache the Git executable to
 # provide speedup when using Git repeatedly (as update.sh does).
 git() {
   if [[ -z "$GIT_EXECUTABLE" ]]
diff --git a/Library/Homebrew/test/.simplecov b/Library/Homebrew/test/.simplecov
index 3dec7d3b7c46fd97fb529e9f09905c69a0fa0afd..b3f87cfdb77bdd333461d10cec537a5aedaed32f 100644
--- a/Library/Homebrew/test/.simplecov
+++ b/Library/Homebrew/test/.simplecov
@@ -34,7 +34,7 @@ SimpleCov.start do
   add_group "OS", "/Homebrew/os/"
   add_group "Requirements", "/Homebrew/requirements/"
   add_group "Scripts", %w[
-    /brew.rb
+    /Homebrew/brew.rb
     /Homebrew/build.rb
     /Homebrew/postinstall.rb
     /Homebrew/test.rb
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 642fadf5f020feea2f6757df9d225d1329afb380..c020deaf49dd10536dc5733caa6aa9e2fd7e0aec 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -64,7 +64,7 @@ class IntegrationCommandTests < Homebrew::TestCase
       cmd_args << "-rsimplecov"
     end
     cmd_args << "-rintegration_mocks"
-    cmd_args << (HOMEBREW_LIBRARY_PATH/"../brew.rb").resolved_path.to_s
+    cmd_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
     cmd_args += args
     Bundler.with_original_env do
       ENV["HOMEBREW_BREW_FILE"] = HOMEBREW_PREFIX/"bin/brew"
diff --git a/bin/brew b/bin/brew
index 77611c153da7fa3ffc2266178d3a8ad8753d1f73..0fabbb97ef595c132bb52ec53f69b3a5277d3599 100755
--- a/bin/brew
+++ b/bin/brew
@@ -25,4 +25,4 @@ fi
 
 HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
 
-source "$HOMEBREW_LIBRARY/brew.sh"
+source "$HOMEBREW_LIBRARY/Homebrew/brew.sh"