postgresql – How do I configure my Mac Postgres 9.6 instance to work with my existing openssl version?


I’m using Mac 10.13.6 and PostGres 9.6.15. I can’t upgrade PostGres locally because our production system is on this version. I have this version of openssl

openssl version -a
OpenSSL 1.1.1g  21 Apr 2020 (Library: OpenSSL 1.1.1d  10 Sep 2019)
built on: Fri Mar  6 13:41:59 2020 UTC
platform: darwin64-x86_64-cc
options:  bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr) 
compiler: clang -fPIC -arch x86_64 -O2  -arch x86_64 -fno-common -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -D_REENTRANT -DNDEBUG -DNDEBUG -arch x86_64
OPENSSLDIR: "/usr/local/mysql/ssl"
ENGINESDIR: "/usr/local/mysql/lib/engines-1.1"
Seeding source: os-specific

I would prefer to keep this version of openssl installed because I have other projects that depend on it. When I try and run any version of a Postgres command, e.g. “psql” or “pgdump,” I get the below error

$ pg_dump
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/Cellar/postgresql@9.6/9.6.15/lib/libpq.5.dylib
  Reason: image not found
Abort trap: 6

I have the below installed. Not sure if there’s any way I can repoint something via an env var?

/usr/local/lib/libevent_openssl-2.1.7.dylib
/usr/local/lib/libevent_openssl.dylib
/usr/local/Cellar/curl-openssl/7.65.3/lib/libcurl.dylib
/usr/local/Cellar/curl-openssl/7.65.3/lib/libcurl.4.dylib
/usr/local/Cellar/libevent/2.1.8/lib/libevent_openssl-2.1.6.dylib
/usr/local/Cellar/libevent/2.1.8/lib/libevent_openssl.dylib
/usr/local/Cellar/libevent/2.1.11/lib/libevent_openssl-2.1.7.dylib
/usr/local/Cellar/libevent/2.1.11/lib/libevent_openssl.dylib
/usr/local/Cellar/openssl@1.1/1.1.1g/lib/libssl.dylib
/usr/local/Cellar/openssl@1.1/1.1.1g/lib/libssl.1.1.dylib
/usr/local/Cellar/openssl@1.1/1.1.1g/lib/libcrypto.dylib
/usr/local/Cellar/openssl@1.1/1.1.1g/lib/engines-1.1/padlock.dylib
/usr/local/Cellar/openssl@1.1/1.1.1g/lib/engines-1.1/capi.dylib
/usr/local/Cellar/openssl@1.1/1.1.1g/lib/libcrypto.1.1.dylib
/Users/davea/.nuget/packages/runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0/runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib
/opt/wildfly-15.0.0.Final/modules/system/layers/base/org/wildfly/openssl/main/lib/macosx-x86_64/libwfssl.dylib
/opt/local/lib/libevent_openssl-2.0.5.dylib