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 81 Answer
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