More permanent stuff at http://www.dusbabek.org/~garyd

03 June 2004

Building and running Postgresql on OS X


./cofigure
# whines about readline
./configure --without-readline
make
su root
make install
# add postgres user with Netinfo Manager
# make sure to assign a shell
mkdir
chown postgres
su postgres
/usr/local/pgsql/bin/initdb -D
su root
touch /var/log/.log
chown postgres /var/log/.log


Then I tried starting pg_ctl (as root):
su postgres -c "pg_ctl start -D -s -l -o '-i -p '"
And I got errors:
FATAL: could not create shared memory segment: Cannot allocate memory
Bummer. So googled around and found I had to increase the amount of alotted shared memory. sysctl -w kern.sysv.shmmax=33554432 should have done the trick, but it wouldn't take. So I ended up editing /etc/rc to put the setting there. It was already set at 4 megs, which apparently isn't enough (older versions of postgres ran fine).

Continuing... (I will use postmaster here because that is most standard, even though I prefer using pg_ctl


/usr/local/pgsql/bin/postmaster -D >/var/log/.log 2>&1 &
/usr/local/pgsql/bin/createdb



Create the database and user:


/usr/local/pgsql/bin/createdb -h -p
/usr/local/pgsql/bin/createuser -a -d -e -P -h -p


You will then be prompted for a password. Now you are ready to connect. Since I usually go in via JDBC, I won't bother with a mini-HOWTO for psql.

0 comments: