-bash: psql: command not found

0

I'm on a Mac 10.11 running psql -h localhost -U monitor -W postgres and I kept getting

-bash: psql: command not found


This is what I have in my paths.

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/pgsql/bin

cyber8200

Posted 2016-08-22T18:18:26.167

Reputation: 217

How did you install pgsql ? – sebastienvg – 2016-08-22T18:53:09.993

I install a Mac app call postgres – cyber8200 – 2016-08-22T18:53:42.250

I usually prefer to use a package manager such as homebrew or fink, anyway I'll try to give you a hand, is it the one you have installed http://postgresapp.com/ ?

– sebastienvg – 2016-08-22T18:57:59.447

Yes, that's it. That is the one. – cyber8200 – 2016-08-22T19:16:21.010

did you export the PATH? export PATH=$PATH://Applications/Postgres.app/Contents/Versions/latest/bin – sebastienvg – 2016-08-22T19:53:59.897

No. Should I do it ? – cyber8200 – 2016-08-22T20:41:45.507

1

Yes you want to follow the instructions from this page http://postgresapp.com/documentation/cli-tools.html in clear just export your path and then you should be good to go.

– sebastienvg – 2016-08-22T20:45:37.760

Thanks for your helps. I will try it tmr at work, and update you. – cyber8200 – 2016-08-22T23:37:29.890

Answers

2

If you have installed Postgres using Postgres app then you need to add psql in your path. Change the Postgres version in the following command.

export PATH=/Library/PostgreSQL/9.6/bin/:$PATH 

Or you can add the above line in ~/.bash_profile or ~/.profile

and then execute the following command

source ~/.bash_profile

https://www.installvirtual.com/question/psql-command-not-found-mac/

Chetan kapoor

Posted 2016-08-22T18:18:26.167

Reputation: 121