Software⏱️ 3 min read📅 2026-06-11

How to Fix: Solve Error without installing PostgreSQL on Mac? dyld: Library not loaded: libpq.5.dylib

Error fixing PostgreSQL library on Mac without installation

Quick Answer: Try installing the libpq.dylib library separately using Homebrew or download it directly from the PostgreSQL website.

The error 'dyld: Library not loaded: libpq.5.dylib' is encountered when trying to perform a backup of a PostgreSQL 13 database running inside a Docker container using TablePlus on a Mac OS X system.

This issue can be frustrating as it prevents the user from completing their task, and installing the entire PostgreSQL server software might be unnecessary for this specific problem.

🔍 Why This Happens

  • The primary reason for this error is that libpq.5.dylib is not being loaded by dyld due to a missing library. This could be caused by various reasons such as an outdated or corrupted system library cache, or a mismatch between the PostgreSQL version in the Docker container and the system's library versions.
  • Another possible cause is that the PostgreSQL version in the Docker container is not compatible with the TablePlus software on Mac OS X.

✅ Best Solutions to Fix It

Using Homebrew to install libpq.5.dylib without installing PostgreSQL

  1. Step 1: Open a terminal and run the command 'brew link pq --force' to link the pq package to the system's library cache.
  2. Step 2: Then, run the command 'brew link pq --force' again to update the link.
  3. Step 3: This method will install libpq.5.dylib without installing the entire PostgreSQL server software.
  4. Step 4: After completing these steps, restart TablePlus and try performing the backup again.

Using Docker's built-in library support

  1. Step 1: Check if the Docker container has the necessary libraries installed by running the command 'docker inspect -f {{.Config.Labels}}' inside the container.
  2. Step 2: If libpq.5.dylib is not present, try adding the following line to the Dockerfile: `RUN apt-get update && apt-get install -y libpq-dev` before copying the PostgreSQL image.
  3. Step 3: This method will ensure that the necessary libraries are installed within the Docker container, eliminating the need for additional installation steps on the host system.

💡 Conclusion

By following one of these methods, you should be able to resolve the 'dyld: Library not loaded: libpq.5.dylib' error and complete your backup of the PostgreSQL 13 database running inside a Docker container using TablePlus on Mac OS X.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions