I have multiple installations of PostgreSQL on my machine, and would like to narrow down to a single installation (MacPorts flavor).
I believe that OSX comes shipped with some sort of package, but I am not aware of where it gets put, or how to troubleshoot where to find it and uninstall.
This has been a huge headache for me, so any help would be appreciated. I'm running 10.7.5.
which postgres
yields:
/usr/local/pgsql/bin/postgres
And in my bash profile, I have:
PG_SQL=/usr/local/pgsql/lib:/usr/local/pgsql/bin
export PG_SQL
port installed
yields:
postgresql92 @9.2.2_0 (active)
postgresql_select @0.1_0 (active)
sh-3.2# find . -iname PG_VERSION
yields:
./postgres/database/base/1/PG_VERSION
./postgres/database/base/12265/PG_VERSION
./postgres/database/base/12270/PG_VERSION
./postgres/database/base/16384/PG_VERSION
./postgres/database/PG_VERSION
that is relative to /Users, btw.
OS X comes with a system Postgres (installed with the base OS, scattered all over, and NOT something you should attempt to uninstall).
If you have no specific Postgres version requirements, use the version installed with OS X.
If you require a specific version of Postgres my suggestion is that you install it from source (following the instructions in the Postgres manual), and place it somewhere where it will not conflict with the Postgres that comes with OS X (
/usr/local/pgsql
is a good location. You can also install it under your home directory if you really want to).You can then set your
PATH
environment variable so the Postgres binary directory you just installed comes before/usr/bin
, and when you runpsql
or other tools you'll be using the ones you installed rather than the ones that come with OS X.(If you have multiple versions of Postgres installed you can uninstall the non-vendor-supplied ones in accordance with the instructions provided by the tool you used to install them. If you want to uninstall Postgres installed from source simply delete the directory it was installed to.)