From a456979948fc32bb331f7db5c4993312fffdcb3b Mon Sep 17 00:00:00 2001 From: Meredith Howard Date: Tue, 26 Aug 2025 11:31:21 -0500 Subject: [PATCH] Detect homebrew prefix path to fix search without pkg-config installed This is `/opt/homebrew` on most macs, which combines just below with `lib/pkgconfig` to get `/opt/homebrew/lib/pkgconfig` in the search paths, which is where all installed & linked homebrew pkgconfig files live. The homebrew repository path has a few .pc files that are versioned by OS release, these files provide pkgconfig info for some libraries bundled in macOS and the Xcode command line tools which don't provide their own. --- lib/pkg-config.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pkg-config.rb b/lib/pkg-config.rb index cdc7512..185500b 100644 --- a/lib/pkg-config.rb +++ b/lib/pkg-config.rb @@ -343,6 +343,11 @@ def compute_default_path homebrew_repository_candidates << Pathname(homebrew_repository.strip) end + homebrew_prefix = run_command("brew", "--prefix") + if homebrew_prefix + homebrew_repository_candidates << + Pathname(homebrew_prefix.strip) + end end homebrew_repository_candidates.uniq.each do |candidate| mac_pkgconfig_base_path =