Question

I downloaded and installed PostgreSQL and PostGIS from KyngChaos for my OS X 10.10 install. When I run psql I get,

bash: psql: command not found

According to the site How to run psql on Mac OS X? it gets installed into /Library/PostgreSQL. There is no file there.

Was it helpful?

Solution

According to the README included in the dmg file, postgres binaries are installed in /usr/local/pgsql/bin/. You should add these lines in your ~/.bashrc :

export PSQL_DIR=/usr/local/pgsql/bin/
export PATH="$PSQL_DIR:$PATH"

Update your environment with source ~/.bashrc or run a new shell and psql should be available.

OTHER TIPS

It appears your problem is regarding setting Environment Variables correctly. After installation, the command psql won't work because you need to set the correct PATH to this command in your Environment variables file - which will differ a little according to your version.

I just wanted to add a comment here for future inquiries.

I'm working on a MacOS Catalina 10.15.2 and the current default terminal is using a SHELL called 'zsh'.

I used the following command from the terminal:

nano ~/.zshrc

and adding the following line:

export PATH="/Library/PostgreSQL/11/bin:$PATH"

control X (to quit) and S (to Save) and ENTER (previous filename) Please note that this path above will depend on your PostgreSQL version - I would recommend you to look this information on your documentation / website.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top