0

Possible Duplicate:
PostgreSQL Permission denied Error on Unix domain socket “/var/pgsql_socket/.s.PGSQL.5432” - Lion Server 10.7.3 or Lion Server 10.7.4

I'm trying to teach myself Rails and would like to be able to deploy to Heroku. Heroku wants me to use PostgreSQL so I tried to install it using homebrew.

Now when I try and interact with the database it tells me:

psql: 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"?

That led me to this question/answer. I tried to follow wolftron's solution, but when I get to the final step:

then use the pg_ctl binary in /usr/local/bin to start the right postgres server successfully (which is where $PATH comes in – make sure which pg_ctl resolves to /usr/local/bin/pg_ctl, or just always call it explicitly).

I run into another fun issue:

localhost: which pg_ctl
pg_ctl not found

So now I try and track down pg_ctl:

sudo find / -name pg_ctl
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/usr/local/bin/archive/pg_ctl

So pg_ctl is in /usr/local/bin/archive/? Why is it there? Did I botch the homebrew install? At this point I started to try and think about how to move it to /usr/local/bin, but its starting to feel like I'm going down a rabbit hole.

Any ideas how to fix this? I am close to just wiping OSX and doing a fresh install, but I'm afraid I'll just get the same issues again...

Community
  • 1
  • 1
l85m
  • 808
  • 1
  • 10
  • 19
  • This has been asked soo many times. Here: http://stackoverflow.com/questions/13114411/postgresql-socket-error-when-running-djangos-syncdb-mac-os-10-7-5 and here http://stackoverflow.com/questions/9133870/postgresql-socket-error-on-osx-10-7-3-when-running-djangos-syncdb and here: http://stackoverflow.com/questions/11443738/postqresql-in-rails-how-do-i-make-the-server-run-locally-and-accept-connections –  Nov 27 '12 at 18:21
  • 1
    In fairness, it's been asked too many times because Apple's decision to place a preinstalled PostgreSQL on the default PATH is a nightmare for users. – Craig Ringer Nov 27 '12 at 18:25
  • I've tried the stuff in those links and always seem to get another error. I'm afraid now I've screwed the install up so bad that there is no turning back - I think I may just go back to mysql until I can find some time for a full system wipe. Getting this set up is ridiculously complex. – l85m Nov 27 '12 at 18:31
  • 1
    @Demosophy Your best option on Mac OS X is to use TCP/IP by specifying `-h localhost` in `psql`, and specifying a hostname in your ruby database configuration. – Craig Ringer Nov 27 '12 at 18:37
  • @Demosophy I feel your pain. Three points: 1) you *can* have one database in development and another in production (although wouldn't recommend SQLLite in dev, and this is probably a short-term workaround), 2) you can just use the Apple-installed PostgreSQL, and 3) if you want to install via homebrew (or reinstall) I do recommend getting back to a known state (which homebrew makes easy -- just delete /usr/local/Cellar/postgresql); then follow the instructions on the posts above. It's worth it. – Tom Harrison Nov 27 '12 at 18:47
  • @tharrison, Craig Ringer- thanks both. I will give this approach a try and see if I can make it work. – l85m Nov 27 '12 at 19:01

0 Answers0