diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 47735a23c1..f39ebbd2a8 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -75,14 +75,15 @@ module Homebrew if f.installed? msg = "#{f.full_name}-#{f.installed_version} already installed" - unless f.linked_keg.symlink? - if f.oldname && (HOMEBREW_CELLAR/f.oldname).exist? - msg << ", it's just not migrated" - elsif !f.keg_only? - msg << ", it's just not linked" - end - end + msg << ", it's just not linked" unless f.linked_keg.symlink? || f.keg_only? opoo msg + elsif f.oldname && (dir = HOMEBREW_CELLAR/f.oldname).exist? && !dir.subdirs.empty? \ + && f.tap == Tab.for_keg(dir.subdirs.first).tap && !ARGV.force? + # Check if the formula we try to install is the same as installed + # but not migrated one. If --force passed then install anyway. + opoo "#{f.oldname} already installed, it's just not migrated" + puts "You can migrate formula with `brew migrate #{f}`" + puts "Or you can force install it with `brew install #{f} --force`" else formulae << f end