small medium large xlarge

Generic-user-small
04 Dec 2011, 11:19
Patrick Mulder (9 posts)

Hi,

the installation of Postgres on Mac was not so easy. Maybe others can share experiences.

  • I installed Postgres 9.1 via Homebrew. I had to setup the paths right as explained here: http://stackoverflow.com/questions/6770649/repairing-postgresql-after-upgrading-to-osx-10-7-lion

  • I had to uninstall the default Postgres 8 versions that was on my Mac, similar as discussed here: http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/

  • There were some issues of wrong SHMMAX values, as discussed here: http://stackoverflow.com/questions/2017004/setting-shmmax-etc-values-on-mac-os-x-10-6-for-postgresql

  • Another problem was setting the permissions right. This discussion helped: http://serverfault.com/questions/43211/postgresql-installation-issues-on-os-x

  • Right now, when trying to run psql book -c “SELECT ‘1’::cube;” The cube package seems not to be installed or found. Evt. the brew formula needs to be patches as discussed here: http://fortnightlabs.posterous.com/installing-postgres-intarray-with-homebrew-on

  • Evt. Installing Postgis instead of Postgres is simpler: http://blog.dyve.net/upgrade-your-mac-to-postgres-9-using-homebrew

Pete_head_pragsmall
04 Dec 2011, 15:52
Peter Brown (2 posts)

Agreed that it was a PITA. I took a slightly different approach to get the first example working, though I’m not sure whether it’s right or wrong:

Installed Postgres 9.1.1 via Homebrew

# Moved /usr/local/bin to the top of /etc/paths # pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start # createdb book # psql -d book -c “CREATE EXTENSION cube” # psql book -c “SELECT ‘1’::cube;”

I found the CREATE EXTENSION syntax at http://archives.postgresql.org/pgsql-general/2011-06/msg00756.php

Generic-user-small
04 Dec 2011, 23:15
Patrick Mulder (9 posts)

Short update regarding memory settings:

The binary installer from EntrepriseDB gives some information on the RAM settings:

On a MacBook Pro with 2GB of RAM, the author’s sysctl.conf contains:

kern.sysv.shmmax=1610612736 kern.sysv.shmall=393216 kern.sysv.shmmin=1 kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.maxprocperuid=512 kern.maxproc=2048

Note that (kern.sysv.shmall * 4096) should be greater than or equal to kern.sysv.shmmax. kern.sysv.shmmax must also be a multiple of 4096.

Once you have edited (or created) the file, reboot before continuing with the installation. If you wish to check the settings currently being used by the kernel, you can use the sysctl utility:

% sysctl -a

Generic-user-small
04 Dec 2011, 23:15
Patrick Mulder (9 posts)

Regarding the createdb command with extensions I get:

psql -d book -c “CREATE EXTENSION cube” psql: warning: extra command-line argument “cube”” ignored psql: FATAL: role “EXTENSION” does not exist

Generic-user-small
07 Dec 2011, 17:51
Matthew Flower (1 post)

I’m running Mac OS X as well. I went the insanely easy route of using a virtual machine. I ended up using turnkey: http://www.turnkeylinux.org/postgresql. (I don’t work for them or anything, it just turned out well for me.)

I installed mine in VMWare Fusion, but their site makes me think that it will work in VirtualBox as well (Parallels? Not sure – probably). I’m sure there are probably other pre-built routes as well.

The only thing that was mildly tricky was figuring out how to install the contrib packages. It turns out that they are in /usr/share/postgresql/8.4/contrib. You do a bunch of things like:

psql -U postgres -W -f cube.sql

</code>

and eventually they’ll all be installed.

25233_377319146748_591736748_3799641_97127_n_pragsmall
11 Dec 2011, 17:24
Eric Redmond (21 posts)

Sadly after all these years PostgreSQL is still not easy to install beyond the stock basics.

Over time I want to collect these pain-points and collect them into a series of solid install guide for various OSs - perhaps a series of articles in PragProg!? In any case, I feel your pain, and I had issues of my own, different from those stated above. The variance of problems and solutions was exactly why we couldn’t spend book real-estate on installing each database on each OS – a pattern discovered and established by Bruce Tate in his Seven Languages book.

Thanks (and sorry) for being guinea pigs!

You must be logged in to comment