title: PG::ConnectionBad Rails and PostgreSQL on development MacOS
body: <p>I've used rails with SQlite and MySQL. First time using PostgreSQL. Just installed PostgreSQL on my local machine. Using Heroku for Production.</p>
  
  <p>Every time I run rake <strong>db:migrate</strong> or <strong>rake db:create</strong> I get the following error:</p>
  
  <pre><code>PG::ConnectionBad: fe_sendauth: no password supplied
  </code></pre>
  
  <p>I installed PostgreSQL with Homebrew, but never setup a user or password.
  Here's my Postgres setup:</p>
  
  <pre><code>Daves-MBP-2:project dave$ ps aux | grep postgres 
  postgres           670   0.0  0.0  2466764   1816   ??  S    Fri10AM   0:00.33 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdflagwriter
  postgres           658   0.0  0.0  2514516   3032   ??  S    Fri10AM   0:01.31 /usr/sbin/distnoted agent
  postgres           657   0.0  0.0  2542724   6336   ??  S    Fri10AM   0:05.69 /usr/libexec/trustd --agent
  postgres           656   0.0  0.0  2545304   6676   ??  S    Fri10AM   0:04.28 /usr/libexec/lsd
  postgres           655   0.0  0.0  2515008   2596   ??  S    Fri10AM   0:00.07 /usr/sbin/cfprefsd agent
  postgres           240   0.0  0.0  2508940    920   ??  Ss   Fri10AM   0:01.06 postgres: stats collector process    
  postgres           239   0.0  0.0  2653940   1860   ??  Ss   Fri10AM   0:00.64 postgres: autovacuum launcher process    
  postgres           238   0.0  0.0  2653940    832   ??  Ss   Fri10AM   0:01.00 postgres: wal writer process    
  postgres           237   0.0  0.0  2653940    900   ??  Ss   Fri10AM   0:01.02 postgres: writer process    
  postgres           236   0.0  0.0  2653940    896   ??  Ss   Fri10AM   0:00.04 postgres: checkpointer process    
  postgres           233   0.0  0.0  2508940    728   ??  Ss   Fri10AM   0:00.00 postgres: logger process    
  postgres           108   0.0  0.0  2654196   3372   ??  Ss   Fri10AM   0:00.32 /Library/PostgreSQL/9.6/bin/postmaster -D/Library/PostgreSQL/9.6/data
  dave             68244   0.0  0.0  2442020   2012 s000  S+    4:28PM   0:00.00 grep postgres
  </code></pre>
  
  <p>Here is my database.yml file</p>
  
  <pre><code># SQLite version 3.x
  #   gem install sqlite3
  #
  #   Ensure the SQLite 3 gem is defined in your Gemfile
  #   gem 'sqlite3'
  #
  default: &amp;default
    adapter: sqlite3
    pool: 5
    timeout: 5000
  
  development:
    adapter: postgresql
    encoding: unicode
    database: "mydatabase"
  
  
  # Warning: The database defined as "test" will be erased and
  # re-generated from your development database when you run "rake".
  # Do not set this db to the same as development or production.
  test:
    &lt;&lt;: *default
    database: db/test.sqlite3
  
  production:
    adapter: postgresql
    encoding: unicode
    url: "HEROKU URL"
  </code></pre>
  
  <p>Here are the settings on pg_hba.conf, which I got from
  - cd /usr/local/var/postgres/
  - open pg_hba.conf
  <a href="https://i.stack.imgur.com/l75Py.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l75Py.png" alt="enter image description here"></a></p>
  
  <p>What am I missing?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here are the contents from the comments below:</p>
  
  <p>First file "com.edb.launchd.postgresql-9.6.plist":</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
          "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;Disabled&lt;/key&gt;
      &lt;false/&gt;
          &lt;key&gt;Label&lt;/key&gt;
          &lt;string&gt;com.edb.launchd.postgresql-9.6&lt;/string&gt;
          &lt;key&gt;ProgramArguments&lt;/key&gt;
          &lt;array&gt;
                  &lt;string&gt;/Library/PostgreSQL/9.6/bin/postmaster&lt;/string&gt;
                  &lt;string&gt;-D/Library/PostgreSQL/9.6/data&lt;/string&gt;
          &lt;/array&gt;
          &lt;key&gt;RunAtLoad&lt;/key&gt;
          &lt;true/&gt;
      &lt;key&gt;UserName&lt;/key&gt;
      &lt;string&gt;postgres&lt;/string&gt;
      &lt;key&gt;KeepAlive&lt;/key&gt;
      &lt;dict&gt;
           &lt;key&gt;SuccessfulExit&lt;/key&gt;
           &lt;false/&gt;
      &lt;/dict&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>Second File "homebrew.mxcl.postgresql.plist":</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;homebrew.mxcl.postgresql&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;/usr/local/opt/postgresql/bin/postgres&lt;/string&gt;
      &lt;string&gt;-D&lt;/string&gt;
      &lt;string&gt;/usr/local/var/postgres&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;WorkingDirectory&lt;/key&gt;
    &lt;string&gt;/usr/local&lt;/string&gt;
    &lt;key&gt;StandardErrorPath&lt;/key&gt;
    &lt;string&gt;/usr/local/var/log/postgres.log&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>