I tried almost all of the answers in this question and this other one and these are the steps that finally worked for me to get postgres to start
- tail the logs for postgres.
the path needs to be updated depending on where postgres is installed, and your version. I am using postgresql@14 on an m1 Monterey and installed it with homebrew.
i finally found the path i needed to look at using this article.
tail /opt/homebrew/var/log/postgresql@14.log
output shows this:
2023-02-03 15:33:49.294 CST [82651] FATAL: could not open directory "pg_notify": No such file or directory
2023-02-03 15:33:49.294 CST [82651] LOG: database system is shut down
go to the / directory and cd opt/homebrew/var/postgresql@14
create the missing directory (maybe this is a different directory for you)
repeat this process for all missing directories.
- I needed to mkdir for
pg_tblspc
, pg_replslot
, pg_twophase
, pg_stat_tmp
, pg_logical/snapshots
, pg_logical/mappings
, pg_commit_ts
, pg_snapshots
, & pg_commit_ts
but i recommend you specifically run the tail command each time to make sure you are not missing different directories & files than me.
finally after running the tail command repeatedly after creating each missing directory, I got this output.
2023-02-03 15:49:18.909 CST [85772] LOG: redo done at 0/17211D8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2023-02-03 15:49:18.914 CST [85771] LOG: database system is ready to accept connections
i was then able to create & migrate my db in my project ・ᴗ・