Postgres not started (PG:ConnectionBad error)
On my first running a rails project on my new M1 Macbook Air, I ran into this error when trying to run rails db:create
PG::ConnectionBad: could not connect to server: No such file or directory
As documented here, usually, I would run this to fix this error: `rm /usr/local/var/postgres/postmaster.pid`
However that returned that this directory didn't exist.
Here is what I did to fix it:
And then this, to start postgres server. I think(?) this also sets up my mac to always start the server at login.
After that, I was able to successfully run rails db:create
Last updated