How do I fix stale postmaster.pid file on Postgres?
The problem is that the postmaster.pid file needs to be removed manually and regenerated by postgres, and these are the steps to do it. (Keep in mind the version might change, var-12, might be var-13 etc)
- Open your terminal, and cd into the postgres directory:
cd /Users/<user_name>/Library/Application\ Support/Postgres
- Make sure you're in the right place,
ls
you should see something likevar-12
orvar-<version #>
- Verify the file is there,
ls var-12
(keep in mind thevar-XX
is equivalent to your PGSQL version) - Verify the Postgres server is not running by viewing desktop app
Version might change so could be var-12, var-13, etc etc depending on age of this article.
Library/Application Support/Postgresā ls var-12PG_VERSION pg_hba.conf pg_replslot pg_subtrans postgresql.auto.confbase pg_ident.conf pg_serial pg_tblspc postgresql.confglobal pg_logical pg_snapshots pg_twophase postgresql.logpg_commit_ts pg_multixact pg_stat pg_wal postmaster.optspg_dynshmem pg_notify pg_stat_tmp pg_xact postmaster.pid <----
- Then remove postmaster.pid,
rm var-12/postmaster.pid
- or
rm var-<PG version #>/postmaster.pid
- Go back to your console, start your postgres server, and it should be functioning again, and you should have full access to your schemas.