Postgresql Did Not Work After I Updated to OS X Yosemite(With Solution)

This morning, I tried to start up an application on Rails with a Postgresql server and had this error:

PG::ConnectionBad: could not connect to server: Connection refused
>       Is the server running on host "localhost" (::1) and accepting
>       TCP/IP connections on port 5432?
>     could not connect to server: Connection refused
>       Is the server running on host "localhost" (127.0.0.1) and accepting
>       TCP/IP connections on port 5432?

Checked server.log and it showed me what directories it was looking for. I also went to where postgresql gets stored to confirm the suspicion.

cd /usr/local/var/postgres

The directories pg_tblspc pg_twophase pg_stat_tmp were missing. These directories are empty anyways but when you boot up your pg server the server looks for them. I think the Yosemite update got rid of these directories. So I created them again anyways.

mkdir pg_tblspc pg_twophase pg_stat_tmp

And added a .keep file in them so that I don’t have this problem in future OS updates.

touch pg_tblspc/.keep pg_twophase/.keep pg_stat_tmp/.keep

Voilá

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s