I'm setting up a new computer to use an existing Rails application (Rails 3.2 with Postgres). I installed postgres via homebrew, along with the Lunchy gem as documented here: http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/. No problems getting a user account and starting/running my application. I ran rake db:create:all to create all of the databases. The site works and loads from only one Terminal tab.
When I open a new tab, same location, and try to start the server, I get the following error:
Users/jpetrarca/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize': could not connect to server: No such file or directory (PG::Error)
19:24:39 web.1 | Is the server running locally and accepting
19:24:39 web.1 | connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
I don't know why one terminal session would work and another not.
Interestingly, I can start/stop postgres with lunchy from the non-working terminal and it does, in fact, use the same service and turns off the db being accessed from the working terminal (which is expected).
I initially found this problem while trying to run my rspec tests and connect to the test db.