title: postgres unattended install fails on "unknown login: postgres"
body: <p>I am building an application installer that installs postgresql 9.x in the "unattended" mode. The main script copies the application files into place, then installs postgres via installbuilder.sh. The main script is invoked with admin privileges. I invoke the pg installer in the script as follows:</p>
  
  <pre><code>log "=== install DBMS engine  ==="
  ./postgresql-9.1.2-1-osx.app/Contents/MacOS/installbuilder.sh --mode unattended --superaccount postgres --superpassword MySecretWord
  </code></pre>
  
  <p>On Mac OS X 10.7 "Lion", the pg installer runs along for a bit then fails out. The bitrock-installer.log contains the following statements:</p>
  
  <pre><code>Preparing to Install
  Executing su - postgres -c "\"/Library/PostgreSQL/9.1/bin/pg_ctl\" stop -m fast -w -D \"/Library/PostgreSQL/9.1/data\""
  Script exit code: 1
  
  Script output:
  
  Script stderr:
   su: unknown login: postgres 
  </code></pre>
  
  <p>At this point, the system, osx 10.7, has a user account "PostgreSQL" but not one named "postgres". After the error in the log are two more errors involved launchd then all subsequent scripts complete normally.</p>
  
  <p>It appears I need to add the postgres group and user prior to installing postgres, but I wonder if that is really the issue. </p>
  
  <p>I have seen advice to modify the PostgreSQL user name, but that is after the installation has run, and that is a bit untidy.</p>
  
  <p>Is adding an account "postgres" the correct thing to do?</p>