Search code examples
postgresqlzshpsql

Postgresql Error in psql command not found in zsh mac


I have installed postgresql on my mac!

  • However when I run the command "psql" it says:
zsh: command not found: psql
  • I have located the location of my psql command (with other all postgres commands + pgadmin) and it is in /Users/Library/PostgreSQL/13/bin

  • when I do echo $PATH I get:

/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  • Now what do I do to run psql without any error?

Solution

  • /Users/Library/PostgreSQL/13/bin is not in your "path"

    Easy solution would be to create a symbolic link for psql in /usr/local/bin/:

    ln -s /Users/Library/PostgreSQL/13/bin/psql /usr/local/bin/psql
    

    Otherwise you can edit your profile file and extend your path to /Users/Library/PostgreSQL/13/bin