4

I have the issue described in: Repairing Postgresql after upgrading to OSX 10.7 Lion but didn't get it solved.

The Postgres application generating the error is at /usr/bin/psql, but the correct one is at /Library/PostgreSQL/9.1/bin/psql.

When I add the later to my path in .bash_profile (or even in /etc/paths), uninstall and install the PG gem, then I still receive the error:

.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1161:in `initialize': could not connect to server: Permission denied (PG::Error) Is the server running locally and accepting

I tried it several times, also with the option:

-- --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config 

Any idea?


EDIT:

After reading through more posts (like http://www.iainlbc.com/2011/10/osx-lion-postgres-could-not-connect-to-database-postgres-after-homebrew-installation), I just did the following:

sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/

And it worked. I don't know at all why. Do I have two installations of Postgres? Where is the app laying behind the /usr/bin/psql file?

Community
  • 1
  • 1
  • OSX 10.7 comes with PostgreSQL (9.0.5) client libraries and command-line utilities. OSX 10.7 Server has the PostgreSQL server, too. – Michael Granger Feb 27 '12 at 21:13

1 Answers1

2

After running find / -name .s.PGSQL.5432 -ls, I noticed that the result was:

47366187 0 srwxrwxrwx 1 postgres wheel 0 Dec 3 15:15 /private/tmp/.s.PGSQL.5432

Note that the PGSQL socket file is /private/tmp/.s.PGSQL.5432

Using your suggestion above (but modifying it a bit), I did this:

sudo ln -s /private/tmp /var/pgsql_socket

Restarted terminal and it worked.

Jamon Holmgren
  • 23,738
  • 6
  • 59
  • 75