diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index 6630afba11..f20b7ad54c 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -2,7 +2,7 @@ require "sandbox" module Homebrew def postinstall - ARGV.resolved_formulae.each { |f| run_post_install(f) } + ARGV.resolved_formulae.select(&:post_install_defined?).each { |f| run_post_install(f) } end def run_post_install(formula) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 9ea9b31aeb..ba1da07bf3 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -400,11 +400,13 @@ class FormulaInstaller link(keg) fix_install_names(keg) - if build_bottle? && formula.post_install_defined? - ohai "Not running post_install as we're building a bottle" - puts "You can run it manually using `brew postinstall #{formula.full_name}`" - else - post_install + if formula.post_install_defined? + if build_bottle? + ohai "Not running post_install as we're building a bottle" + puts "You can run it manually using `brew postinstall #{formula.full_name}`" + else + post_install + end end ohai "Summary" if verbose? || show_summary_heading?