title: Postgres asks for password, even though pg_hba.conf says trust
body: <p>I have installed PostgreSQL 9.3 on my Mac. I am trying to do this command:</p>
  
  <hr>
  
  <pre><code>$ sudo -u postgres psql template1
  Password:
  Password: 
  psql: FATAL:  password authentication failed for user "postgres"
  </code></pre>
  
  <hr>
  
  <p>As you can see, it asks for a password, which I give it. And it fails. I try the password for the postgres user, and the computer password. It always says it fails. </p>
  
  <p>I read that you can change the pg_hba.conf file to not ask for a password. It is below: </p>
  
  <pre><code>&gt; # TYPE  DATABASE        USER            ADDRESS                 METHOD
  &gt; 
  &gt; # "local" is for Unix domain socket connections only 
  &gt; local   all             all                                     trust
  &gt; # IPv4 local connections: 
  &gt; host    all             all             127.0.0.1/32            trust
  &gt; # IPv6 local connections: 
  &gt; host    all             all             ::1/128                 trust
  &gt; # Allow replication connections from localhost, by a user with the
  &gt; # replication privilege. 
  &gt; local   replication     postgres                                trust 
  &gt; host    replication     postgres        127.0.0.1/32            trust          
  &gt; host    replication     postgres        ::1/128                 trust 
  </code></pre>
  
  <p>From my understanding this should not ask for a password. And yet it does.</p>
  
  <p>Interesting note: it logs in fine in pgAdmin3. But not in terminal.</p>
  
  <p>Update #1:</p>
  
  <p>Tried to restart PostgreSQL after I change the pg_hba.conf file. This is the message I get.</p>
  
  <pre><code>$ pg_ctl -D postgres -l server.log restart
  pg_ctl: PID file "postgres/postmaster.pid" does not exist
  Is server running?
  starting server anyway
  pg_ctl: could not read file "postgres/postmaster.opts"
  </code></pre>