install command-line
$ xcode-select --install
install postgresql
download from postgresapp.com Postgres.app
$ mv Postgres.app /Applications
$ vi .bash_profile
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
install gnu support for compile (m4, autoconf, automaker, libtool)
http://www.gnu.org/software/m4/
$ tar -xzvf m4-1.4.17.tar.gz
$ cd m4-1.4.17
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
http://www.gnu.org/software/autoconf/
$ tar -xzvf autoconf-2.69.tar.gz
$ cd autoconf-2.69
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
http://www.gnu.org/software/automake/
$ tar xzvf automake-1.15.tar.gz
$ cd automake-1.15
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
http://www.gnu.org/software/libtool/
tar xzvf libtool-2.4.6.tar.gz
cd libtool-2.4.6
./configure --prefix=/usr/local
make
sudo make install
install php pdo_pgsql
$ php -v
download php-5.5.29.tar.gz from php.net
[php version same current mac]
$ tar -zxvf php-5.5.29.tar.gz
$ cd php-5.5.29/ext/pdo_pgsql
$ phpize
$ ./configure --with-pdo-pgsql=/Applications/Postgres.app/Contents/Versions/9.4/
$ make
$ sudo make install
at this time there will be an install error, because the mac filesystem permission problem, so…
$ cp modules/pdo_pgsql.so /usr/local/lib/
$ vi /etc/php.ini
extension=/usr/local/lib/pdo_pgsql.so
$ sudo apachectl start
$ php -m
<?php
echo phpinfo();
?>