Harsha M V
Harsha M V

Reputation: 54989

psql: could not connect to server: No such file or directory on MAC OSX

I am trying to install PostgreSQL on my MAC using home brew and when i try to run the command psql i am getting the following error

Harshas-MacBook-Pro:~ harshamv$ psql
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Looks like the system is not recognizing the installation.

Harshas-MacBook-Pro:~ harshamv$ locate psql | grep /bin
/usr/local/Cellar/postgresql/9.4.0/bin/psql
/usr/local/bin/psql

The process seems to be running

    Harshas-MacBook-Pro:~ harshamv$ ps -aef|grep postgres  
      501 12075 11832   0 11:54AM ttys001    0:00.00 grep postgres

Also the plist file

Harshas-MacBook-Pro:~ harshamv$ launchctl load -w /usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist  
/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: Operation already in progress


Harshas-MacBook-Pro:~ harshamv$ which psql
/usr/local/bin/psql

Harshas-MacBook-Pro:~ harshamv$ echo $PATH
/Users/harshamv/.rvm/gems/ruby-2.1.2/bin:/Users/harshamv/.rvm/gems/ruby-2.1.2@global/bin:/Users/harshamv/.rvm/rubies/ruby-2.1.2/bin:/Applications/bin/php5/bin/:/Applications/Mamp/htdocs/prayag/lib/Cake/Console:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/harshamv/.rvm/bin:/usr/local/mongodb/bin

Upvotes: 0

Views: 6178

Answers (1)

Schwern
Schwern

Reputation: 165586

You're not running a PostgreSQL server. Your ps output only shows your own ps grep.

You also might have two versions of PostgreSQL installed and you're running the psql client associated with the wrong one. You can run which -a psql to see all psql binaries in your PATH.

The PostgreSQL Wiki has a page devoted to figuring out Homebrew problems.

This answer to your exact problem may help.

Upvotes: 1

Related Questions