Postgres8 quick install

This is a quick guide on how to setup postgres 8.1 under osx using DarwinPorts:


% sudo port install postgresql8 
% mkdir -p ~/Databases/Postgres
% mate /etc/profile

# Append following lines to the file:
export PATH=/opt/local/lib/pgsql8/bin:$PATH
export PGDATA=$HOME/Databases/Postgres

% source /etc/profile

# compile postgres ruby drivers
% sudo gem install postgres -- 
    --with-pgsql-include-dir=/opt/local/include/pgsql8/ 
    --with-pgsql-lib-dir=/opt/local/lib/pgsql8/

# create the postgres DB
% initdb

# start your database server. pg_ctl supports start / stop / reload 
% pg_ctl start 

# create the root superuser
% createuser root 

# create your db
% createdb blog_dev

If you want to get rid of the NOTICE spam which appears when running rake open $PGDATA/postgresql.conf change client_min_messages from notice to warning and run “pg_ctl restart”.

Update: Dave let me know that instead of using the postgres gem you should be using


sudo gem install ruby-postgres