diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 0f2a1875d3..ba9745f1aa 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -50,6 +50,7 @@ module Homebrew extend self def clean_cache HOMEBREW_CACHE.children.each do |pn| + next unless pn.file? pn.stem =~ /^(.+)-(.+)$/ # greedy so works even if formula-name has hyphens in it if $1 and $2 f = Formula.factory($1) rescue nil