diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 6b2f5ea0c6..8fad2b48bf 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -105,7 +105,6 @@ module Homebrew extend self fi = FormulaInstaller.new(f) fi.install fi.caveats - f.linked_keg.unlink if f.linked_keg.directory? and f.linked_keg.realpath == f.prefix fi.finish rescue FormulaAlreadyInstalledError => e opoo e.message diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 39c9565455..72cfa69e5d 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -158,6 +158,12 @@ class FormulaInstaller end def link + if f.linked_keg.directory? and f.linked_keg.realpath == f.prefix + opoo "This keg was marked linked already, continuing anyway" + # otherwise Keg.link will bail + f.linked_keg.unlink + end + Keg.new(f.prefix).link rescue Exception => e onoe "The linking step did not complete successfully"