HowTo: Use a different path for the Datastore

By default, the PostgreSQL for Mac project places everything, including the data storage into the /Library/PostgreSQL8 folder.  The downside of this, is that in some installations, it may be desirable to move the data storage to a different location.   In order to do that, there are a couple of changes that need to be made.  

These changes must be made with the PostgreSQL service stopped, please make sure that you have stopped the database first.

During the installation process, a PostgreSQL data library is initialized.  That default library can be rebuilt, or built in another location at any time, or the existing one can be moved.  For building the library, PostgreSQL provides a command called 'initdb' that will build the path.  For more information about initdb, please review the man pages, or the PostgreSQL official documentation.

From the PostgreSQL for Mac perspective, once the new data library is initialized, be it copied, or moved, the only remaining change is to alter the StartupItem to know the correct path.  The StartupItem can be viewed and edited in any text editor, as it is just a shell script.  Open the file /Library/StartupItems/PostgreSQL/PostgreSQL in your favorite text editor.  In that file, you will find two references to '-D /Library/PostgreSQL8/data' these two entries ned to be change to reflect the full path of the new Data library, as specified to initdb.  With these changed, the PostgreSQL server is ready to be started using the new path.  Using the Service Manager, click start.