Skip to content

Instantly share code, notes, and snippets.

@phlco
Created March 1, 2016 20:58
Show Gist options
  • Save phlco/1e034be0e5ff517816c4 to your computer and use it in GitHub Desktop.
Save phlco/1e034be0e5ff517816c4 to your computer and use it in GitHub Desktop.
postgres fix

if

psql: 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"?

check with

cat /usr/local/var/postgres/server.log 

then fix with

rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8

so that you can

sudo mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}
sudo chmod -R 0700 /usr/local/var/postgres
sudo chown -R ${USER} /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.*/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
createdb ${USER}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment