[SOLVED] Error connecting to Postgresql server cannot load libpq.dylib lazarus / 16-Databases ---------------------------------------------------------------------- Frogfather · 2019-09-07 21:05 Hi, I'm receiving the following error when trying to connect to any database on a Postgresql 11.3 server running on MacOS 10.14.6 Mohave. Postgresql was installed using homebrew so I'm wondering if the error is caused by the library being in an unexpected location: (/usr/local/Cellar/postgresql/11.3/lib). libpq.dylib is a link to libpq.5.11.dylib. FPC version: 3.0.4, Lazarus version: 2.0.4, SVN Revision: exported, i386-darwin-carbon ...some weeks later... I'll answer my own question in case anyone has the same problem: Recompiling as 64 bit fixes the issue!.  This post describes a similar problem https://forum.lazarus.freepascal.org/index.php?topic=41312.0 and this extremely clear and well written article https://macpgmr.github.io/MacXPlatform/UsingCocoaFromTrunk.html shows how to do it.