I installed PostgreSQL via the graphical install on http://www.postgresql.org/download/macosx/
I see it in my applications and also have the psql terminal in my applicat
If Postgresql was downloaded from official website. After installation, running these commands helped me resolve the psql issue.
Go to your home directory with cd ~
In your home directory, run ls -a. Edit the .bash_profile file with vim
vi .bash_profile opens the vim editor.
Insert by pressing i on the editor.
Add export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/
The Version Number refers to the version number of the postgresql installed on your local machine. In my case, version 12 was installed, so I inputed
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/12/bin .
Press the esc key and press :wq to exit the editor.
Enter source .bash_profile in your terminal to read and execute the content of a file just passed as an argument in the current shell script.
Run psql
terminal result
In summary:
cd ~vi .bash_profileexport PATH=$PATH:/Applications/Postgres.app/Contents/Versions/12/bin Take note of the version numberexit vimsource .bash_profilepsql Works