title: First ruby and postgreSql application - getting could not connect to server: No such file or directory
body: <blockquote>
    <p>Ruby 1.9.3 on Mac OS X Lion</p>
  </blockquote>
  
  <p>Followed several posts on SO about this topic. Neither helped.</p>
  
  <p>Trying to run my <strong>first</strong> rails and postgreSQL app here.</p>
  
  <p>Following this:
  <a href="http://guides.rubyonrails.org/getting_started.html" rel="nofollow">http://guides.rubyonrails.org/getting_started.html</a></p>
  
  <p>When I do:</p>
  
  <pre><code>"rake db:create"
  </code></pre>
  
  <p>I get:</p>
  
  <blockquote>
    <p>could not connect to server: No such file or directory Is the server
    running locally and accepting connections on Unix domain socket
    "/tmp/.s.PGSQL.5432"?</p>
  </blockquote>
  
  <p>Some facts:</p>
  
  <p>Not sure what /tmp/ is it referring to but, if it is the one from root, then:</p>
  
  <p>1)
  Permissions:</p>
  
  <p>drwxrwxrwx   11 root  wheel   374B Jan  4 17:33 tmp</p>
  
  <p>2)
  Also, I see no file .s.PGSQL.5432.</p>
  
  <p>3)
  I've tried to force the socket location by adding to database.yml the following:</p>
  
  <pre><code>development:
      adapter: postgresql
      encoding: unicode
      database: testblog_development
      pool: 5
      username: blog
      password:
      socket: /var/pgsql_socket # &lt;-- this line
  </code></pre>
  
  <p>(it stills shows me the same error with the /tmp/ path).</p>
  
  <p>4) When I do, <code>which postgres</code> I get:</p>
  
  <pre><code>/usr/local/bin/postgres 
  (I've used homebrew installation)
  </code></pre>
  
  <p>5) When I do: <code>brew info postgres</code> I get:</p>
  
  <blockquote>
    <p>postgresql: stable 9.2.2 <a href="http://www.postgresql.org/" rel="nofollow">http://www.postgresql.org/</a> Depends on:
    readline, ossp-uuid Conflicts with: postgres-xc
    /usr/local/Cellar/postgresql/9.2.2 (2819 files, 39M) *
    <a href="https://github.com/mxcl/homebrew/commits/master/Library/Formula/postgresql.rb" rel="nofollow">https://github.com/mxcl/homebrew/commits/master/Library/Formula/postgresql.rb</a></p>
  </blockquote>
  
  <p>and other bunch of information.</p>