Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have multiple installations of postgres 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.

Thanks, jml

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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 run psql 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.)

share|improve this answer
1  
I should mention that I ended up using the macports install anyway, because of dependencies with another library (was just easier). That install ended up in /opt/local/bin/postgres. All seems to be fine now, and defaulting correctly upon a reboot of the machine. –  jml Feb 25 '13 at 20:37
    
I think MacPorts sets your path up for you, and the location it installs to (/opt/local) is safe from OS X upgrades trashing things, so you should be fine with that too. –  voretaq7 Feb 25 '13 at 20:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.