Question: I just got a new mac and am getting everything installed on it (postgres, postgis, qgis, grass, gdal, brew, ruby, etc) and am about to install QGis.

QGis is a great tool for me, except for that with my other mac I was never able to get it to connect to PostgreSQL.

PGAdmin always worked when connecting, but connecting QGis to the Postgres.app implementation of Postgresql never was able to connect. The error messages were depressingly vague (just recreated): `Connection failed - Check settings and try again.`

So my question is this. What are the ideal settings that allow qgis to connect easily to postgresql? I've found Postgres.app an easy to use implementation, but should I abandon it and use the normal brew-installed postgresql instead to get qgis to connect?

Or even better, is there a qgis/postgresql co-installation somewhere that would come close to guaranteeing inter-functionality between these two systems?

UPDATE:
(after temporarily removing the Postgres.app PostgreSQL implementation)
When I run this command:

```
brew install qgis --with-grass --with-postgis

```

brew starts off by installing postgresql. I'm going with this for now and am hoping the "pipes" between QGis & PostgreSQL will be setup to communicate with one another...

Answer: 
If I understand, you have used [Homebrew](http://brew.sh/) to install all, why ?

Compatibility
-------------

It is much easier to use the solutions of [KyngChaos](http://www.kyngchaos.com/) that ensure the compatibility.

* [QGIS](http://www.kyngchaos.com/software/qgis)
* [GRASS GIS](http://www.kyngchaos.com/software/grass)
* [PostgreSQL/PostGIS](http://www.kyngchaos.com/software/postgres)
* [GDAL/OGR](http://www.kyngchaos.com/software/frameworks#gdal_complete) and other libraries

These solutions use the standard Apple Python (no need of [Homebrew](http://brew.sh/))

And yes, it is possible to install all with [Homebrew](http://brew.sh/) or [MacPorts](http://www.macports.org/), but it is more difficult if you don't know the UNIX part of Mac OS X.

PostgreSQL/PostGIS
------------------

To connect to a PostgreSQL service, you need a host, a Port, the name of a database, a user and the password of the user. Traditionally the host is "localhost" and the Port = 5432 (same procedure for QGIS, PgAdminIII or others PostgreSQL clients) but others installations of PostgreSQL use other ports.

> 
> Connection failed - Check settings and try again.
> 
> 
> 

So, what is the host and the Port of your PostgreSQL installation ? I've never had any problems with the connection QGIS/PostgreSQL, whatever the installed version installed
last time i have same problem :

what i have done to solve that is refer on this link <http://hub.qgis.org/issues/735>
i hope can solve your problem to.

the problem is because postgres still limit connection. if you have add configuration for truth the localhost for connection to database everything running smooth.

Other thing you must consider after have connection is to activate the PostGIS extension.
Happy Mapping.