47

Does anyone know how I can install libpq-dev on Mac OS 10.6? It's a pre-requisite for something else I want to install.

There doesn't seem to be a macport for it, so how can I install it on a Mac?

Gaff
  • 18,569
  • 15
  • 57
  • 68
Richard
  • 481
  • 1
  • 5
  • 4

4 Answers4

65

Consider using Homebrew

brew install postgresql

It'll give you the necessary headers.

  • 14
    I don't want to install Postgresql on my Mac! I have Postgres already running in a Docker container. Just want to make this dam pg gem running. Any way to install only some kind of pg-dev header packages? – Robert Reiz Aug 19 '15 at 09:07
  • 3
    Well one thing to consider is just cause you install pg via homebrew, it doesn't mean you have to run the deamon (server). Just use the client that way, I doubt it takes up much space anyways. – Michael de Silva Aug 19 '15 at 16:55
  • It does take up significant space: `brew` requires 1Gb of its own git repo in order to function at all. – Will Sheppard Jun 30 '23 at 08:51
22

You can install libpq (dev files are included) alone using homebrew.

brew install libpq

The include files and libs are then available in the following folders:

/usr/local/opt/libpq/lib
/usr/local/opt/libpq/include
Starscream
  • 321
  • 2
  • 3
4

When I've search in ports I've found this:

port search libpq
libpqxx @3.0.2 (databases, devel)
    Official C++ client API for PostgreSQL

libpqxx26 @2.6.9 (databases, devel)
    Official C++ client API for PostgreSQL

You can try one of those.

pconcepcion
  • 235
  • 4
  • 11
0

Using macports, this worked for me:

sudo port install postgresql96
sudo port select --set postgresql postgresql96

I believe this installs all the postgres client tools and libs, while macports has a separate port for installing the server, i.e. postgresql96-server.

joshperry
  • 170
  • 5