diff --git a/Library/Homebrew/unpack_strategy/zip.rb b/Library/Homebrew/unpack_strategy/zip.rb index 9f2174d1be..7e8815a88a 100644 --- a/Library/Homebrew/unpack_strategy/zip.rb +++ b/Library/Homebrew/unpack_strategy/zip.rb @@ -27,10 +27,17 @@ module UnpackStrategy .returns(SystemCommand::Result) } def extract_to_dir(unpack_dir, basename:, verbose:) + unzip = begin + Formula["unzip"] + rescue FormulaUnavailableError + nil + end + with_env(TZ: "UTC") do quiet_flags = verbose ? [] : ["-qq"] result = system_command! "unzip", args: [*quiet_flags, "-o", path, "-d", unpack_dir], + env: { "PATH" => PATH.new(unzip&.opt_bin, ENV["PATH"]) }, verbose: verbose, print_stderr: false