Unpack it somewhere convenient and change to that directory.
Configure using the default installation location (/usr/local/pgsql) and a minimal set of options.
And finally, make install. For /usr/local installation this will need sudo.
PostgreSQL should now be installed in /usr/local/pgsql.
Post Installation steps
Add the PostgreSQL bin directory to Path and export by adding the following to your .bash_profile or .profile:
Create a directory to hold the database installation.
Create a postgres user and a postgres group. Change ownership of the pgsql directory to postgres. PostgreSQL cannot be access by root (a security measure, one assumes). (Snow Leopard (10.6) eliminates the netinfo tool, so you get to build the group on the command line.)
First find an unused User ID. The following command shows IDs already in use.
Next find an unused Group ID, again the following command shows IDs already in use.
On the my system 103 was available in both lists, the rest of these directions assume you are using the same number. The following commands create the group and the user and set the user’s home directory to the pgsql folder.
I was forced to visit the Accounts preference pane in System Preferences to reset the password for the postgres account. For reasons I don't understand setting it via the dscl command failed.
Finally, give the postgres user ownership of the /usr/local/pgsql directory:
Now you can switch users to the postgres account and run the initdb command to create a database installation. The command is:
The output should look something like:
Now you can start up the database server. I prefer the second of the two command examples shown at the end of the initialization step above:
As it starts the database server in the background, thus freeing up your console for other uses.
To stop a server running in the background you can type:
Now you can create a database. Make sure you are operating as the *postgres* user, and issue the _createdb_ command.
Connect to the database, and start experimenting with SQL commands.
The postgres user account will appear in the fast user switching (FUS) list and as an account on the login screen. To hide the account on the login screen run the following command:
While this will hide postgres from the login window it will not hide it from the FUS list. Additionally, the list of accounts on the login window will have an “Other…” entry which will allow you to access the hidden account.