title: Repairing postgresql after upgrade to OSX Mavericks
body: <p>A recent upgrade to OSX Mavericks has broken my database connection for my Rails app.</p>
  
  <p>When I try to fetch from the database the server returns the following error:</p>
  
  <pre><code>PG::ConnectionBad (could not connect to server: Connection refused
      Is the server running on host "localhost" (::1) and accepting
      TCP/IP connections on port 5432?
  could not connect to server: Connection refused
      Is the server running on host "localhost" (127.0.0.1) and accepting
      TCP/IP connections on port 5432?
  could not connect to server: Connection refused
      Is the server running on host "localhost" (fe80::1) and accepting
      TCP/IP connections on port 5432?
  </code></pre>
  
  <p>When try to run <code>psql</code> I get:</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>
  
  <hr>
  
  <p>I've tried many of the solutions available on the internet. Such reinstalling the pg gem and setting host: localhost in my database.yml. My /usr/local/var/postgres/pg_hba.conf file says:</p>
  
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # "local" is for Unix domain socket connections only
  local   all             all                                     trust
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            trust
  # IPv6 local connections:
  host    all             all             ::1/128                 trust
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  #local   replication     RyanKing                                trust
  #host    replication     RyanKing        127.0.0.1/32            trust
  #host    replication     RyanKing        ::1/128                 trust
  </code></pre>
  
  <p>which psql returns: <code>/usr/local/bin/psql</code></p>
  
  <hr>
  
  <p>Any solutions on this one? Some solutions suggest I need to change my $PATH to my previous postgres installation as a new version of postgres would be added with Mavericks. How do I find where that is located? It's quite possible it was installed with homebrew but I'm not certain.</p>