skip to Main Content

I am using a mac and when i use psql in terminal i got zsh: command not found: psql
I searched and saw that i should set up the PATH export PATH=${POSTGRES_HOME}/bin:${PATH} so my question where i do this ? and what are the variables between { }.

2

Answers


  1. Chosen as BEST ANSWER

    I missed this :

    sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp


  2. In the end, it’s your decision where to do it. I suggest that you read first the section "STARTUP/SHUTDOWN FILES" in the zsh man page to see what files are processed by zsh on start and on this choose the one which is best for you.

    For instance, If you want the setting it for every zsh (interactive and non-interactive, login and non-login) shells, your ~/.zshenv would be the place to go. If you want it for any interactive shell only, put it into ~/.zshrc.

    In any case, I suggest that you add the command

    typeset -aU path
    

    This avoids that the same directory will be added again and again by each zsh child process.

    Finally, you may find it more convenient to use path instead of PATH:

    path+=($POSTGRES_HOME/bin)
    

    Since the scalar PATH is tied to the array path, you can use either one.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search