Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to start PostgreSQL server on Mac OS X?
    text
    copied!<p>FINAL UPDATE:</p> <p>I had forgotten to run the initdb command.</p> <p>&lt; /FINAL UPDATE></p> <p>by running this command</p> <pre><code>ps auxwww | grep postgres </code></pre> <p>I see that postgres 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: 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 touch 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 rails server, I still see this:</p> <pre><code>Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? </code></pre> <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 WAS NO pg_hba.conf (only pg_hba.conf.sample) 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., "su") 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 "*postgresql.conf*" 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>still getting the same "Is the server running?" message.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload