0

Everytime I try to run psql on my mac 10.8 I get the error message:

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

According to this post on the problem it's a PATH issue.

I tried editing my path by opening my .profile and adding the line: export PATH=/usr/local/bin:$PATH

However, when I do which psql it still shows /usr/bin/psql.

Why isn't it showing the proper path I want: /usr/local/bin/psql ?

Community
  • 1
  • 1
user1328021
  • 9,110
  • 14
  • 47
  • 78

1 Answers1

1

Have you restarted your shell since editing your .profile?

Are you sure that /usr/local/bin/psql exists and has the correct permissions?

Are you sure that you're using bash? (You can type echo $0 at the shell prompt to see.) If your shell is tcsh then you'd need to add this line to ~/.tcshrc or ~/.cshrc instead. What would be even easier, though, would be to add this to your ~/.login:

setenv PATH=/usr/local/bin:$PATH

That will make sure that the changes take effect no matter which shell you use.

bdesham
  • 15,430
  • 13
  • 79
  • 123
  • Yes I have restarted it and it says I'm using bash. But `/usr/local/bin/psql` does not exist. – user1328021 Feb 27 '13 at 15:52
  • Are you installing psql with Homebrew? Try running `brew doctor` to check your setup, and if necessary, uninstall and reinstall the package. – bdesham Feb 27 '13 at 15:53
  • I didn't install with Homebrew... Just downloaded from the web: http://postgresapp.com/ and then ran the installer. – user1328021 Feb 27 '13 at 15:55
  • Ah. In that case, the path to `psql` should be `/Applications/Postgres.app/Contents/MacOS/bin/psql`. You can just add `/Applications/Postgres.app/Contents/MacOS/bin` to your `PATH`. – bdesham Feb 27 '13 at 15:59
  • Ok just say I already have this in my path `export PATH=/opt/local/bin:/opt/local/sbin:$PATH`.... How exactly should I add it (sorry for the noobness of this question). – user1328021 Feb 27 '13 at 16:01
  • No problem :-) Just change that line to `export PATH=/Applications/Postgres.app/Contents/MacOS/bin:/opt/local/bin:/opt/local/sbin:$PATH` – bdesham Feb 27 '13 at 16:05