--- psycopg/pq/misc.py.orig	2025-05-22 13:56:33
+++ psycopg/pq/misc.py	2025-05-22 13:56:47
@@ -64,7 +64,7 @@
             try:
                 import subprocess as sp
 
-                libdir = sp.check_output(["pg_config", "--libdir"]).strip().decode()
+                libdir = sp.check_output(["@@PG_CONFIG@@", "--libdir"]).strip().decode()
                 if not os.path.exists((libname := os.path.join(libdir, "libpq.dylib"))):
                     libname = None
             except Exception as ex:
