From 5310c5e730ef33843d7aac82e544b55c0d11ba1f Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 1 Jul 2025 22:22:43 +0100 Subject: [PATCH 1/2] Fix "undefined method 'name' for an instance of FormulaInstaller" - Because `name` is not a method on `FormulaInstaller`, instead `formula` shows the name. - Fixes issue 20199. Before: ``` $ brew install -n hello Error: undefined method 'name' for an instance of FormulaInstaller Warning: Removed Sorbet lines from backtrace! Rerun with `--verbose` to see the original backtrace /opt/homebrew/Library/Homebrew/install.rb:330:in 'Array#map' /opt/homebrew/Library/Homebrew/install.rb:330:in 'Homebrew::Install.install_formulae' ``` After: ``` $ brew install -n hello ==> Would install 1 formula: hello ``` --- Library/Homebrew/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 28dac7e823..2c58703abb 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -327,7 +327,7 @@ module Homebrew end if dry_run - if (formulae_name_to_install = formula_installers.map(&:name)) + if (formulae_name_to_install = formula_installers.map(&:formula)) ohai "Would install #{Utils.pluralize("formula", formulae_name_to_install.count, plural: "e", include_count: true)}:" puts formulae_name_to_install.join(" ") From c7af63488d61eee50f02fc444b17e95b61b3e68e Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 3 Jul 2025 11:29:50 +0100 Subject: [PATCH 2/2] Be more explicit that we want the formula name --- Library/Homebrew/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 2c58703abb..404252c406 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -327,7 +327,7 @@ module Homebrew end if dry_run - if (formulae_name_to_install = formula_installers.map(&:formula)) + if (formulae_name_to_install = formula_installers.map { |fi| fi.formula.name }) ohai "Would install #{Utils.pluralize("formula", formulae_name_to_install.count, plural: "e", include_count: true)}:" puts formulae_name_to_install.join(" ")