title: Accessing postgresql server over network in Mac
body: <p>I have installed <a href="http://postgresapp.com/" rel="noreferrer">Postgres App</a> on my Mac and have a database running. </p>
  
  <p>I am able to connect it from the terminal by using the command <code>psql -h localhost</code></p>
  
  <p>Now I want to access this server from another machine which is on the same network.</p>
  
  <p>When I do <code>psql -h &lt;hostname&gt; -U &lt;username&gt;</code> from the other machine, I get the error </p>
  
  <pre><code>psql: could not connect to server: Connection refused
      Is the server running on host "my hostname" (xx.xx.xx.xxx) and accepting
      TCP/IP connections on port 5432?
  </code></pre>
  
  <p>In the machine that runs the server I did <code>lsof -i | grep LISTEN</code> and I get the following result.</p>
  
  <pre><code>postgres  3196 sudarm    5u  IPv6 0x1caf6120      0t0  TCP localhost:5432 (LISTEN)
  postgres  3196 sudarm    6u  IPv4 0x14678db0      0t0  TCP localhost:5432 (LISTEN)
  postgres  3196 sudarm    7u  IPv6 0x1caf6a80      0t0  TCP localhost:5432 (LISTEN)
  </code></pre>
  
  <p>Do I have to do anything else to connect to the server from another machine?</p>