2

I installed PostgreSQL using the interactive installer by EnterpriseDB following this link. It defaulted the installation directory to /Library/PostgreSQL/9.6. After successful install, psql is not in the $PATH. I have to navigate to the installation directory or enter the full path execute it:

cd /Library/PostgreSQL/9.6/bin
./psql -d template1

Must I add this path to .profile or .bash_profile, create a symlink to /usr/bin? What approach is more suitable for the Mac?

Because this is not working:

# ln -s /Library/PostgreSQL/9.6/bin/psql /usr/bin/psql
ln: /usr/bin/psql: Operation not permitted

Temporary solution:

sh-3.2# ln -s postgres /usr/local/bin/postgres
sh-3.2# ln -s createdb /usr/local/bin/createdb
sh-3.2# ln -s createuser /usr/local/bin/createuser
sh-3.2# ln -s dropdb /usr/local/bin/dropdb
sh-3.2# ln -s dropuser /usr/local/bin/dropuser
sh-3.2# ln -s initdb /usr/local/bin/initdb
sh-3.2# ln -s pg_ctl /usr/local/bin/pg_ctl
sh-3.2# ln -s pg_dump /usr/local/bin/pg_dump
sh-3.2# ln -s pg_dumpall /usr/local/bin/pg_dumpall
1
  • It appears the EnterpriseDB installation is junk. I wanted to use Postgis and I read the installer notes: postgis.net/install (The OSX PostgreSQL/Stackbuilder combination from EnterpriseDB has had mixed reliability. Avoid) May 9, 2017 at 21:28

1 Answer 1

3

In contrary to other PostgreSQL installers (e.g. Homebrew), the EnterpriseDB installer doesn't install the PostgreSQL executables in a path covered by your default $PATH.

So either add it to your .bash_profile file

...
export PATH="/Library/PostgreSQL/9.6/bin:$PATH"
...

or

...
export PATH="$PATH:/Library/PostgreSQL/9.6/bin"
...

or symlink the executables to /usr/local/bin:

ln -s /Library/PostgreSQL/9.6/bin/* /usr/local/bin

You can't link them to /usr/bin/ because this path is protected by SIP and - after disabling SIP - a sudoer would have to prepend sudo to link the files. /usr/local/bin is the default path for user installed executables anyway, so stay with this one.

1
  • 1
    I guess homebrew was the way to go Dec 2, 2016 at 1:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .