7

Attempting to get Rails running with postgresql on mac osx 10.8 to deploy to heroku. I'm new to mac's.

Had lots of trouble just getting PostgrSQL installed so I could have botched up something trying all the potential solutions I could find searching on that subject. Which mainly appeared to be permissions and existing OSX installation. for this issue I'm noticing some things that make me think there is some fundamental directory or version conflict that I'm not sure how to resolve yet. But I could be wrong and it is something else! Any direction is appreciated.

retrieving an error such as this:

$ rake db:create:all
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

I'm not sure where and why it's looking for the var directory but ~/var appears to be a link (alias) to /private/var (which has empty pgsql_socket & pgsql_socket_alt directories), /usr/local/var doesn't have pgsql_socket directory but does have a postgres directory. both of those directories my admin user has read & write permission from the finder get info dialog.

The above error shown is followed by a long stack in the gems 1.8 directory and finishes with this:

Couldn't create database for {"pool"=>5, "database"=>"blog_development", "password"=>nil, "username"=>"USERNAME", "encoding"=>"unicode", "adapter"=>"postgresql"}

so checking:

   $ which psql
/usr/bin/psql

i do remember after installing postgresql i did this:

  initdb /usr/local/var/postgres -E utf8

Confirmed:

$ ps aux | grep postgres
username           346   0.0  0.1  2479616   7724   ??  S     3:08PM   0:00.03 /usr/local/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log

bundle show yields: pg (0.14.1)

$ postgres --version
postgres (PostgreSQL) 9.2.1

echo $PATH does not show any reference to posgresql. this app is in a /Users/USERNAME/SUBDIR/APP.

Andy ideas on where i've messed up and how i can get this stuff up and running? I'd appreciate any direction. I'll keep working through stack overflow and google discussions; although my stupidity may be unique!

Thanks.

5
  • Do you have host and port set in your database.yaml? P.S. homebrew is the easiest way to install postgresql, mysql, etc. Commented Oct 7, 2012 at 21:16
  • i did install through home brew. host and port is not in the .yml. What should those values be? Following railscasts doesn't show the need to edit .yml with that info. Commented Oct 7, 2012 at 21:31
  • per a this discussion moved "/usr/local/bin" to top of etc/paths file so which psql output was changed to /usr/local/bin/psql... that did not work for me. I'm searching and trying it all! Commented Oct 7, 2012 at 21:43
  • This doesn't seem right? '$ sudo find ~/ -name "pg_hba.conf" /Users/USERNAME//Library/Application Support/Postgres/var/pg_hba.conf' Commented Oct 7, 2012 at 22:07
  • added host: localhost to database.yml and now everything appears fine. i was able to rake db:create:all and get rails s about your applications output. THANKS. NOt sure i understand why that had to take place? Thanks Commented Oct 7, 2012 at 22:21

1 Answer 1

25

Add

host: localhost

to database.yml

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.