diff --git a/Library/Homebrew/extend/os/mac/caveats.rb b/Library/Homebrew/extend/os/mac/caveats.rb index 2a3f8a8029..7abc7655ad 100644 --- a/Library/Homebrew/extend/os/mac/caveats.rb +++ b/Library/Homebrew/extend/os/mac/caveats.rb @@ -37,9 +37,14 @@ class Caveats if f.plist_manual || f.service? command = if f.service? - f.service.command - .map { |arg| (arg =~ /\s/) ? "'#{arg}'" : arg } # wrap multi-word arguments in quotes - .join(" ") + f.service + .command + .map do |arg| + next arg unless arg.match?(/\s/) + + # quote multi-word arguments + "'#{arg}'" + end.join(" ") else f.plist_manual end