title: Postgres Fatal role name is not permitted to log in
body: <p>A couple of months ago I started with postgres for Heroku, this worked then. This week I had to use postgres again...</p>
  
  <p>When trying to run a rails server I get: </p>
  
  <pre><code>PG::ConnectionBad
  FATAL: role "codemonkey" is not permitted to log in
  
  config/initializers/quiet_assets.rb:7:in `call_with_quiet_assets'
  </code></pre>
  
  <p>I am using postgres 9.4.4 and I am trying to use the Postgres.app to get in. (I also have pgAdmin3.)</p>
  
  <p>In the terminal: </p>
  
  <p>When I run <code>su postgres psql</code> I get: <code>/usr/local/bin/psql: /usr/local/bin/psql: cannot execute binary file</code> after entering my password. </p>
  
  <p>When I do <code>su postgres' I first get a 'bash-3.2$</code> environment. This environment (obviously) gives: <code>bash: ALTER: command not found</code> when I type: <code>ALTER ROLE codemonkey WITH LOGIN;</code></p>
  
  <p><em>small additional edit</em><br>
  Thanks to a_horse_with_no_name I know that in this bash-3.2$ environment I can start psql (as the superuser). I am not sure if it's working though, I get <code>could not save history to file "/Library/PostgreSQL/9.4/.psql_history": No such file or directory</code> after my SQL command. And am still left with the same FATAL error. </p>
  
  <p>At some point I got:</p>
  
  <p><code>shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied</code></p>
  
  <p>When I use the postgres.app elephant symbol and click "open psql" and enter my password I get: <code>psql: FATAL:  role "codemonkey" is not permitted to log in</code> after entering my password.</p>
  
  <p>This is what my ~/.bash_profile looks like: Should I do something to add postgres commands? It never recognizes anything. </p>
  
  <pre><code>export PATH=/usr/local/bin:$PATH
  
  # Setting PATH for Python 3.4
  # The orginal version is saved in .bash_profile.pysave
  PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
  export PATH
  ### Added by the Heroku Toolbelt
  export PATH="/usr/local/heroku/bin:$PATH"
  export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
  if which rbenv &gt; /dev/null; then eval "$(rbenv init -)"; fi
  if which rbenv &gt; /dev/null; then eval "$(rbenv init -)"; fi
  </code></pre>
  
  <p>This is what my pg_hba.conf looks like:</p>
  
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # "local" is for Unix domain socket connections only
  local   all             postgres                                indent
  # IPv4 local connections:
  host    all             codemonkey     127.0.0.1/32            trust
  # IPv6 local connections:
  host    all             all             ::1/128                 trust
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  #local   replication     codemonkey                                trust
  #host    replication     codemonkey        127.0.0.1/32            trust
  #host    replication     codemonkey        ::1/128                 trust
  </code></pre>
  
  <p>I think at some point I should be able to give the command ALTER ROLE codemonkey WITH LOGIN;</p>
  
  <p>So I can get through. I wish I knew how.</p>
  
  <p><strong>COMPLETE RE-EDIT</strong></p>