title: Postgresql server will not start after OS X Yosemite upgrade, homebrew
body: <p><strong>Steps to recreate error:</strong></p>
  
  <ul>
  <li><code>brew uninstall postgresql</code></li>
  <li><code>brew prune</code></li>
  <li><code>brew install postgresql</code></li>
  <li>run postgresql start commands</li>
  <li><code>psql</code></li>
  </ul>
  
  <p>yields:</p>
  
  <pre><code>psql: could not connect to server: No such file or directory
  Is the server running locally and accepting
  connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
  </code></pre>
  
  <p><strong>Suggested fixes I have tried that don't work:</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/13410686/postgres-could-not-connect-to-server">create missing symbolic link:</a></p>
  
  <ul>
  <li><code>sudo mkdir /var/pgsql_socket/</code></li>
  <li><code>sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/</code></li>
  </ul>
  
  <p>remove postmaster.pid file (same link as above):</p>
  
  <ul>
  <li><code>rm /usr/local/var/postgres/postmaster.pid</code></li>
  </ul>
  
  <p><a href="https://stackoverflow.com/questions/25970132/pg-tblspc-missing-after-installation-of-os-x-yosemite">create potentially "cleaned up" directories from upgrade:</a></p>
  
  <ul>
  <li><code>mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/
  touch /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/.keep</code></li>
  </ul>
  
  <p><a href="https://github.com/Homebrew/homebrew/issues/14527" rel="nofollow noreferrer">Related GitHub issue</a></p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/19147026/cannot-restart-postgres-on-mac-os-x">This article</a> correctly speculates that there are multiple versions of postgres in use, and which <code>pg_ctl</code> must be specified (below). Strangely, there are two directories in <code>/usr/local/var</code>: <code>postgre</code> &amp; <code>postgres</code>. If anybody knows which settings to update to use the proper <code>pg_ctl</code> command directly, I would appreciate it!</p>
  
  <p><code>/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_ctl -D /usr/local/var/postgre start</code></p>