diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 003a860dc2..24435b0b76 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -193,7 +193,7 @@ class Keg def rooted_in_build_directory?(filename) # CMake normalises `/private/tmp` to `/tmp`. # https://gitlab.kitware.com/cmake/cmake/-/issues/23251 - return true if HOMEBREW_TEMP.to_s == "/private/tmp" && filename.start_with?("/tmp") + return true if HOMEBREW_TEMP.to_s == "/private/tmp" && filename.start_with?("/tmp/") filename.start_with?(HOMEBREW_TEMP.to_s) || filename.start_with?(HOMEBREW_TEMP.realpath.to_s) end