I’ve recently started playing around with Ruby on Rails, starting with the excellent Rails for Zombies Redux and Rails for Zombies 2 courses from Code School (highly recommended). I made it all the way through both over the course of last weekend (as anyone following me on Twitter feed can attest), finally earning the much coveted RFZ2 Survivor badge seen at right.
Wanting to keep plugging away at it, I decided to watch the also excellent Rails App From Scratch webcast on Code School TV. I made it all of about three minutes in before they recommended installing Postgres, so I dutifully paused, jumped into Terminal, and fired up homebrew. And that’s when Mountain Lion reared its ugly head.
Seems, for some reason, that Mountain Lion doesn’t create a socket file in the place that rake is expecting to find it. After getting everything installed and my user and databases created, I was able to connect fine from the
psql tool and see that
which psql returned the correct one in
/usr/local/bin/psql. Running rake db:create or rake db:migrate would throw a nice long stack trace starting with:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/
(Create the directory then make a symbolic link to where the socket file actually lives).
Hope that helps!