title: Postgres Database Local Installation / Running
body: <p>Trying to setup Postgres / PostGIS on OSX Mountain Lion to use with Django. However, something is wrong and I am not sure how to fix it.</p>
  
  <pre><code>$ createdb geo
  createdb: could not connect to database postgres: could not connect to server: No such file or directory
      Is the server running locally and accepting
      connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
  
  $ postgres -D /usr/local/var/postgres
  FATAL:  lock file "postmaster.pid" already exists
  HINT:  Is another postmaster (PID 221) running in data directory "/usr/local/var/postgres"?
  
  $ pg_ctl -D /usr/local/var/postgres -l logfile start
  pg_ctl: another server might be running; trying to start server anyway
  server starting
  </code></pre>
  
  <p>Then I found <a href="https://gist.github.com/vlado/1877457" rel="nofollow noreferrer">this gist</a> that said how to fix it on lion. However it did not work for me:</p>
  
  <pre><code>$ kill -9 221
  $ pg_ctl -D /usr/local/var/postgres stop
  waiting for server to shut down.... done
  server stopped
  
  $ pg_ctl -D /usr/local/var/postgres start
  pg_ctl: another server might be running; trying to start server anyway
  server starting
  FATAL:  lock file "postmaster.pid" already exists
  HINT:  Is another postmaster (PID 1436) running in data directory "/usr/local/var/postgres"?
  </code></pre>
  
  <p>Another attempt:</p>
  
  <pre><code>$ cd /usr/local/var/postgres
  $ mv postmaster.pid postmaster.backup
  $ pg_ctl -D /usr/local/var/postgres start
  server starting
  
  $ LOG:  could not bind IPv6 socket: Address already in use
  HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
  LOG:  could not bind IPv4 socket: Address already in use
  HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
  LOG:  could not bind IPv6 socket: Address already in use
  HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
  WARNING:  could not create listen socket for "localhost"
  FATAL:  could not create any TCP/IP sockets
  </code></pre>
  
  <p>Has anyone successfully done this with mountain lion? If so, what am I missing? Thanks for your help with this issue!</p>