drewk.net
consulting & development
projects / portfolio
resume
contact
 
Andrew Kaluzniacki
PostgreSQL on OS X
23 March 2004
 

Last time I looked into the matter (early 2003) - PostgreSQL was considered a bettter db than MySQL - this may not be as true now since it seems that MySQL supports transactions, but I do not want to do that research yet again.

See apple developer site for complete PostgreSQL on OS X notes.

#sudo  /sw/bin/fink install readline
Make a directory for postgres and get the source.
drewsG5:/usr/local/src drew$ sudo bash
drewsG5:/usr/local/src root# mkdir postgres
drewsG5:/usr/local/src root# cd postgres/
drewsG5:/usr/local/src/postgres root# curl -O ftp://ftp10.us.postgresql.org/pub/postgresql/source/v7.4.2/postgresql-7.4.2.tar.gz
drewsG5:/usr/local/src/postgres root#  tar -xzvf postgresql-7.4.2.tar.gz
drewsG5:/usr/local/src/postgres root# cd postgresql-7.4.2
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# ./configure --with-includes=/sw/include/ --with-libraries=/sw/lib --with-java

--with-java builds the jdbc drivers but we need Ant to do this.

So into .bash_profile go the following lines:

# ant
export ANT_HOME=/Developer/Java/J2EE/Ant
export PATH=${PATH}:${ANT_HOME}/bin
Well now I get a warning that Bison is too old. So let's get Bison 1.875
[root root]# cd /usr/local/src
[root src]# curl -O http://ftp.gnu.org/gnu/bison/bison-1.875.tar.gz
[root src]# tar xfz bison-1.875.tar.gz
[root src]# cd bison-1.875
[root src]# ./configure
[root src]# make install
This puts bison in /usr/local/bin leaving the old one in /usr/bin/ so I add
export PATH=/usr/local/bin:${PATH}
to my .bash_profile
Ok, now
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# ./configure --with-includes=/sw/include/ --with-libraries=/sw/lib --with-java
works without complaint.
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# make
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# make install
Added user: postgres
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# mkdir /usr/local/pgsql/data
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# chown postgres /usr/local/pgsql/data
drewsG5:/usr/local/src/postgres/postgresql-7.4.2 root# su -l postgres
drewsG5:~ postgres$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
So now I can start the server.
drewsG5:~ postgres$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start 
postmaster successfully started
Now to go look at settting up MovableType for my blog. And see if Netbeans sees Postgres.
Well there is some config to be done to get netbeans to see the db. Move the jdbc driver to where netnbeans can find it.
Configure postgres to listen on localhost:5432
 
 
 
Copyright 2003-2004 Andrew Kaluzniacki. All rights reserved.