bash psql command not found

After installation of PostgreSQL on MAC OS, when tried to connect to PostgreSQL using psql tool then received error:

bash: psql: command not found

bash psql command not found

Steps to fix this issue:

1. Check the .bash_profile exists or not. If not there, then run the following steps in sequence
a) create a file

tocuh .bash_profile

b) Open the profile

open -t .bash_profile

Then enter the PostgreSQL bin directory. In my case: /Library/PostgreSQL/11/bin/

export PATH=${PATH}:/Library/PostgreSQL/11/bin/

2. Then, try to connect to the server.

Same steps explained in the following video.

Or

1 . Solution is goto cd /etc/profile.d/

2. Create a .sh file like below
touch postgresqlprofile.sh

3. Add the below line to postgresqlprofile.sh by vi postgresqlprofile.sh

export PATH=/usr/pgsql-11/bin:$PATH

4. Then run the command psql. You will connect to PostgreSQL server 11 successfully.