3yuerw
Last Updated: February 25, 2016
·
590
· warfox

PostgreSQL 9.3 initial setup on Mac OSX 10.9.2 using MacPorts

After sudo port install postgresql93 postgresql93-server

# switch to su
sudo su

mkdir /var/lib/pgsql/

chown -R postgres:wheel /var/lib/pgsql

su postgres

export PGDATA=/var/lib/pgsql/9.3/data

initdb

createdb pgdbname

createuser -A -D pgusername

exit

exit

# startdb
sudo -u postgres postgres -D /var/lib/pgsql/9.3/data/

# check if login works
psql -h localhost pgdbname pgusername

\q

# add PGDATA to ~/.bash_profile
echo "export PGDATA=/var/lib/pgsql/9.3/data" >> ~/.bash_profile

PostgreSQL 9.3 initial setup on Mac OSX 10.9.2