Using PostgreSQL on macOS

When looking at the virtual-environments for macOS, it lists PostgreSQL as a pre-installed utility, see https://github.com/actions/virtual-environments/blob/911f1685c48bf1c1c1578aaf232469a674398c78/images/macos/macos-10.15-Readme.md#utilities

I’m trying to run my tests, but I don’t know how to connect to the installed PostgreSQL server. My testcases fail with

exception: connection failed: could not connect to server: Connection refused
Is the server running on host “localhost” (::1) and accepting
TCP/IP connections on port 5432?

  • What connection string do I have to use? (host, dbname, user, password)
  • Do I need to start the server first? How?

Note that I’m using the “services” for PostgreSQL with Linux, which works just fine. I would also like to run the tests on Windows, but that is probably a separate question/issue. In case it matters, here’s the project I’m talking about: https://github.com/taocpp/taopq

I recently found out how to run jobs with the PostgreSQL service on Windows and macOS, you can see the current workflow files here: GitHub - taocpp/taopq: C++ client library for PostgreSQL