title: How can I start PostgreSQL server on Mac OS X?
body: <h3>Final update:</h3>
  <p>I had forgotten to run the <code>initdb</code> command.</p>
  <hr/>
  <p>By running this command</p>
  <pre><code>ps auxwww | grep postgres
  </code></pre>
  <p>I see that <code>postgres</code> is not running</p>
  <pre><code>&gt; ps auxwww | grep postgres
  remcat          1789   0.0  0.0  2434892    480 s000  R+   11:28PM   0:00.00 grep postgres
  </code></pre>
  <p>This raises the question:</p>
  <p>How do I start the PostgreSQL server?</p>
  <p>Update:</p>
  <pre><code>&gt; pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
  server starting
  sh: /usr/local/var/postgres/server.log: No such file or directory
  </code></pre>
  <p>Update 2:</p>
  <p>The <em>touch</em> was not successful, so I did this instead:</p>
  <pre><code>&gt; mkdir /usr/local/var/postgres
  &gt; vi /usr/local/var/postgres/server.log
  &gt; ls /usr/local/var/postgres/
  server.log
  </code></pre>
  <p>But when I try to start the Ruby on Rails server, I still see this:</p>
  <blockquote>
  <p>Is the server running on host &quot;localhost&quot; and accepting
  TCP/IP connections on port 5432?</p>
  </blockquote>
  <p>Update 3:</p>
  <pre><code>&gt; pg_ctl -D /usr/local/var/postgres status
  pg_ctl: no server running
  </code></pre>
  <p>Update 4:</p>
  <p>I found that there <em><strong>wasn't any</strong></em> <em>pg_hba.conf</em> file (only file <em>pg_hba.conf.sample</em>), so I modified the sample and renamed it (to remover the .sample). Here are the contents:</p>
  <pre><code> # IPv4 local connections:
   host    all             all             127.0.0.1/32           trust
   # IPv6 local connections:
   host    all             all             ::1/128                trust
  </code></pre>
  <p>But I don't understand this:</p>
  <pre><code>&gt; pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
  server starting
  &gt; pg_ctl -D /usr/local/var/postgres status
  pg_ctl: no server running
  </code></pre>
  <p>Also:</p>
  <pre><code>sudo find / -name postgresql.conf
  find: /dev/fd/3: Not a directory
  find: /dev/fd/4: Not a directory
  </code></pre>
  <p>Update 5:</p>
  <pre><code>sudo pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
  Password:
  pg_ctl: cannot be run as root
  Please log in (using, e.g., &quot;su&quot;) as the (unprivileged) user that will own the server process.
  </code></pre>
  <p>Update 6:</p>
  <p>This seems odd:</p>
  <pre><code>&gt; egrep 'listen|port' /usr/local/var/postgres/postgresql.conf
  egrep: /usr/local/var/postgres/postgresql.conf: No such file or directory
  </code></pre>
  <p>Though, I did do this:</p>
  <pre><code>&gt;sudo find / -name &quot;*postgresql.conf*&quot;
  find: /dev/fd/3: Not a directory
  find: /dev/fd/4: Not a directory
  /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample
  /usr/share/postgresql/postgresql.conf.sample
  </code></pre>
  <p>So I did this:</p>
  <pre><code>egrep 'listen|port' /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample
  #listen_addresses = 'localhost'        # what IP address(es) to listen on;
  #port = 5432                # (change requires restart)
                  # supported by the operating system:
                  #   %r = remote host and port
  </code></pre>
  <p>So I tried this:</p>
  <pre><code>&gt; cp /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf
  &gt; cp /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/postgresql.conf
  </code></pre>
  <p>I am still getting the same &quot;Is the server running?&quot; message.</p>