Skip to content

Instantly share code, notes, and snippets.

@hrwgc
Last active December 29, 2015 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrwgc/7662446 to your computer and use it in GitHub Desktop.
Save hrwgc/7662446 to your computer and use it in GitHub Desktop.
postgres / postgis randomly stops working on osx mavericks - fix

Following advice of Psql: could not connect...:

Running the following command resets PostgreSQL's transaction log, which resolves the problem.

 pg_resetxlog -f /usr/local/Cellar/postgresql/9.3.1/data

you should replace /usr/local/Cellar/postgresql/9.3.1/data with your own pg_datadir (eg., pg_ctl -D $DATADIR start)

~ ▶ pg_ctl -D /usr/local/Cellar/postgresql/9.2.2/data start
~ ▶ LOG: database system was interrupted; last known up at 2013-10-28 13:42:30 EDT
LOG: could not open file "pg_xlog/000000010000001F000000BB" (log file 31, segment 187): No such file or directory
LOG: invalid primary checkpoint record
LOG: could not open file "pg_xlog/000000010000001F000000B8" (log file 31, segment 184): No such file or directory
LOG: invalid secondary checkpoint record
PANIC: could not locate a valid checkpoint record
LOG: startup process (PID 1706) was terminated by signal 6: Abort trap
LOG: aborting startup due to startup process failure
~ ▶ pg_ctl -D /usr/local/Cellar/postgresql/9.2.2/data -l logfile restart
pg_ctl: PID file "/usr/local/Cellar/postgresql/9.2.2/data/postmaster.pid" does not exist
Is server running?
starting server anyway
server starting
~ ▶ psql
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"?
~ ▶
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment