Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing postgresql with Homebrew and Rails on Mountain Lion

I have been having a lot of trouble installing Postgresql on my computer.

I have a Rails app that I deploy to Heroku and want to use Postgresql on my local machine. Before I downloaded Postgres.app but never really used it and recently uninstalled it thinking it may be causing some problems.

I install Postgres and every time I run rake db:create:all, I get the following error:

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've Googled and tried a bunch of things but have not been able to figure it out and thought I might finally have to get some personal help.

When running which psql I get:

/usr/local/bin/psql

I've tried uninstalling Postgres, uninstalling pg and re-installing it but nothing has been able to work.

Any insight here? Thank you.

like image 357
Victor Avatar asked Nov 24 '12 05:11

Victor


1 Answers

IF you are installing it with homebrew did you install the launch daemon so that the server starts up?

look at brew info postgresql

you will need to init the db

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

then start the server

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

Then you should be able to create your databases, and use it locally. If you are going to be using it you should follow the directions listed in brew for starting and stopping it automatically..

like image 73
Doon Avatar answered Oct 26 '22 13:10

Doon