title: Postgresql server is running on local machine but psql can not connect
body: <p>After doing <code>brew install postgres</code>:  </p>
  
  <pre><code>brew install postgres
  brew link --overwrite postgresql
  </code></pre>
  
  <p>Postgres is already running:</p>
  
  <pre><code>/~ $brew services start postgresql
  Service `postgresql` already started, use `brew services restart postgresql` to restart.
  </code></pre>
  
  <p>But then how do we connect using <code>psql</code> client?</p>
  
  <pre><code>13:47:28/~ $psql
  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>Updates</strong>    Tried various suggestions.  </p>
  
  <p>Try restarting ..</p>
  
  <pre><code> $brew services start postgresql
  Service `postgresql` already started, use `brew services restart postgresql` to restart.
  14:37:19/fastparquet $brew services restart postgresql
  Stopping `postgresql`... (might take a while)
  ==&gt; Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
  ==&gt; Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
  
  14:37:39/fastparquet $psql
  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"?
  14:37:55/fastparquet $
  </code></pre>
  
  <p>Connect to localhost? </p>
  
  <pre><code>14:37:34/fastparquet $psql -h localhost
  psql: 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?
  </code></pre>