brew update
brew install postgresql
Yosemite appears to delete folders that postgres needs.
mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/
touch /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/.keep
If you have trouble starting postgres, try setting it up first.
rm -rf /usr/local/var/postgres/*
initdb /usr/local/var/postgres -E utf8
createuser --interactive postgres