How to ‘pg_dump’ with Jetbrains Datagrip on macOS

How to ‘pg_dump’ with Jetbrains Datagrip on macOS

If you are using Datagrip from Jetbrains to manage your Postgres database, you might have bumped into difficulties in how to dump (or how to restore) a Postgres SQL dump.

The menus are showing the “commands” but without the binaries, you can’t “run” those. I can’t remember how to install the binaries on a new machine and then I’m searching the net for information, only to usually read articles of frustrated users. On macOS, it is quite easy. All you need to do is to install “libpq”, which can be done via homebrew.

After you have installed homebrew, just run the following command in a terminal window:

brew install libpq

Now you will find different Postgres tools (like pg_dump) in the following folder:

/usr/local/opt/libpq/bin

Those links are sym-linked to another location but never mind that DataGrip will show you the “real” path. Once done, you can run a pg_dump within DataGrip from jetbrains.com on macOS.