Repairing Postgresql after upgrading to OSX 10.7 Lion
It's a PATH issue. Mac OSX Lion includes Postgresql in the system now. If you do a which psql
you'll likely see usr/bin/psql
instead of usr/local/bin/psql
which is HomeBrew's correct one. If you run brew doctor
you should get a message stating that you need to add usr/local/bin
to the head of your PATH env variable.
Editing your .bash_profile or .profile, or whichever shell you're using and adding:
export PATH=/usr/local/bin:$PATH
as the first export for the PATH
then either quit you shell session or source your file with source ~/.bash_profile
and it should now be OK again.
I had this very problem with Mountain Lion but the only thing that worked for me was this fix:
Check where the actual target is:
sudo find / -name .s.PGSQL.5432
I needed to create this directory:
mkdir /var/pgsql_socket/
Then using the result from the find above create this symlink:
ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/
I suspect that for most people on Mountain Lion you can just create the dir and do the symlink and not waste time doing the find unless the symlink doesn't work.
PS - my PostgreSQL was installed through the official installer.
For those of you who are interested, I pieced together the solution. All I needed was to add
host: localhost
to the database.yml for my environment and all was gravy.