Skip to content

A platform for community discussion. Free, open, simple.

DEV: Account for macports installs of postgres in TemporaryDB (#40104)

Martin Brennand86761ac22ca
diff --git a/lib/temporary_db.rb b/lib/temporary_db.rb
index b3f4caf258c..95f1b2efa04 100644
--- a/lib/temporary_db.rb
+++ b/lib/temporary_db.rb
@@ -46,6 +46,12 @@ class TemporaryDb
return @pg_bin_path = bin_path if File.exist?("#{bin_path}/pg_ctl")
end
+ # macOS MacPorts: /opt/local/lib/postgresql{version}/bin
+ @versions.reverse_each do |v|
+ bin_path = "/opt/local/lib/postgresql#{v}/bin"
+ return @pg_bin_path = bin_path if File.exist?("#{bin_path}/pg_ctl")
+ end
+
# Unversioned fallbacks — skipped when the caller pinned a version range.
if @versions == VERSIONS
bin_path = "/Applications/Postgres.app/Contents/Versions/latest/bin"