I finally solved this problem, but not using the previously described methods.
Using brew install postgresql, I find out that it had already been installed, but not linked.
Find out where PostgreSQL is installed, and delete it,
Then brew install postgresql again,
brew link postgresql
gem install pg