diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 90e0dc2d46..40370cec3a 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -333,7 +333,9 @@ class Formulary return TapLoader.new(ref, from: from) end - return FromPathLoader.new(ref) if File.extname(ref) == ".rb" + if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist? + return FromPathLoader.new(ref) + end formula_with_that_name = core_path(ref) if formula_with_that_name.file?