Postgres on OS X

Posted by Graham Stratton Tue, 22 Aug 2006 13:24:40 GMT

Today I needed to install postgres on OS X, and it was sadly rather complex. Therefore, here’s a quick guide for myself in future.

I chose Darwin ports to install Postgres:
sudo port sync
sudo port install postgresql8 +server
the +server command creates a postgres8 user. Then I needed to update my bash profile:
sudo -s
echo "PATH=$PATH:/opt/local/lib/postgresql81/bin" >> /etc/profile
echo "export PATH" >> /etc/profile
echo "export PGDATA=/usr/local/pgsql/data" >> /etc/profile
exit
source /etc/profile
create the data directory and start Postgres:
sudo mkdir -p /usr/local/pgsql
sudo chown postgres8 /usr/local/pgsql/
sudo -u postgres8 initdb
sudo -u postgres8 pg_ctl start
then finally databsaes can be created:
sudo -u postgres8 createdb tutors

Posted in  | no comments

Comments

(leave url/email »)

   Comment Markup Help Preview comment