Skip site navigation (1) Skip section navigation (2)

Re: Total Newbie: Trouble installing postgresSQL on OS X Snow Leopard

From: Brent Dombrowski <brent(dot)dombrowski(at)gmail(dot)com>
To: Kevin Goulding <kevingoulding(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Total Newbie: Trouble installing postgresSQL on OS X Snow Leopard
Date: 2012-01-26 21:42:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Jan 26, 2012, at 10:22 AM, Kevin Goulding wrote:

> Hi all, I am trying to get set up with a database in PostgresSQL and
> eventually postGIS, so followed the install instructions on Kyng Chaos' web
> site:
> (I installed all of the items in the list with the exception of "PostgreSQL
> Client-only 9.1.2-1").  Then I entered the Terminal, and went through the
> following, with little luck.  Can anyone help or point me in the right
> direction to get a new database set up?
>>> My suspicion is that the problem lies in the line (below) where it says:
> *initdb: could not access directory "/usr/local/pgsql-9.1/data": Permission
> denied*
> Many thanks!
> Kevin

The data folder (/usr/local/pgsql-9.1/data) is typically owned by the user "postgres". In order to access that directory, you need to be the postgres user.

I've always done the database initialization as postgres:
$ sudo -u postgres /usr/local/pgsql-9.1/bin/initdb -D /usr/local/pgsql-9.1/data --encoding=UTF8 --local=en_us

>>> My system:  OS X 10.6.8 Snow Leopard
>>> First, I tried to create a new data base called "db1":
> kevin-gouldings-imac:~ kevingoulding$ /usr/local/pgsql/bin/psql -U postgres
> -d db1 -f /usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql
> psql: FATAL:  database "db1" does not exist

This does not create a database. It's trying to connect to an existing database (db1) and run the postgis script. If you haven't installed postgis yet, that script will fail as well.

Postgres creates a database called postgres. Try the following:
$ /usr/local/pgsql-9.1/bin/psql -P postgres -d postgres
If that gets a postgres prompt, then initdb was successful and you are up and running.

Chapter 15 of the manual has lots of details on installing postgres

In response to

pgsql-novice by date

Next:From: Rob RichardsonDate: 2012-01-27 16:54:35
Subject: Order of update triggers
Previous:From: Kevin GouldingDate: 2012-01-26 18:22:14
Subject: Total Newbie: Trouble installing postgresSQL on OS X Snow Leopard

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group