So I'm a newbie to Rails who's only used SQLite3 before, and I'm struggling to even run a simple rake command when using PostgreSQL.
I'm just trying to follow the first 5 minutes of this screencast on installing Postgres: http://railscasts.com/episodes/342-migrating-to-postgresql
But even when I've done everything as instructed, when I run rake db:create:all
I get the ubiquitous error message:
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
I see this everywhere, but can someone answer this definitively, once and for all (if such a task were so simple)?
I used homebrew to install PostgreSQL.
When I run which psql
, it says i'm using the one in usr/bin/psql
, which I believe is the one that is native to Mac OSX Lion (isn't that a bad thing? How do I switch to the one installed by homebrew, which is in usr/local/bin/psql
?).
I'm fairly certain Postgres is at least running: when I run ps auxw | grep postgres
, I get my four processes, such as:
postgres: stats collector process
postgres: autovacuum launcher process
postgres: wal writer process
postgres: writer process
And I was even able to install my pg
gem just fine. I've been spending all day just trying to get Postgres to run, I appreciate any and all help!
EDIT (WITH SOLUTION):
Referencing this link:
Repairing Postgresql after upgrading to OSX 10.7 Lion
There was indeed a path issue. So I edited my .bash_profile as instructed, and switched from using my native psql installation in usr/bin/psql
to the one installed by homebrew, usr/local/bin/psql
.
Then, I uninstalled my pg gem, and then reinstalled it, and then rake dr:create:all started working. :)
EDIT 2:
Actually, I'm still having loads of problems! This is so frustrating! :)