Sometimes switching it off and on again actually causes the problem
I feel like I’ve wasted the morning. In an attempt to get the sound buttons on my mac working again (I have no idea why they stopped), I restarted my computer. Classic solution. However, upon booting puma to work on a project I was faced with a PG connection error:
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Eurgh. Fine. To Google. Turns out postgres didn’t shut down properly. This meant that when I tried to restart my server, postgres thought one was already running and threw an error. My first inclination was to have a look at what systems were currently running on my computer by typing `ps` into the terminal.
The internet laid out a number of possible solutions, the main one being to make sure that I didn’t have any postgres systems running (I didn’t) and then to delete the postman.pid file. I tried a number of different commands in an attempt to find the file but to no avail. I did find a postgres folder here:
But that didn’t contain any postman.pid.
Eventually I resorted to searching via Finder and including system files (here is a helpful walkthrough):
Which then led me here:
How many postgres folders are there?! And also again, no .pid. I also had a look at this post ‘PostgreSQL stale ‘postmaster.pid’ error’ but there was no Postgres folder in that particular location. For reference, a quicker way to find a folder is using the following command:
mdfind kind:folder "postgres"
No .pid in sight, so scrap that for a second then, let’s have a look at the logs.
Now this, upon some Googling, is an issue with node and homebrew. Maybe homebrew needs updating? Nope. Do I completely scrap it and start again? Don’t really want to do that.
I attempted the following command to try and reset the contents of that particular folder:
brew uninstall --ignore-dependencies node icu4c
brew install node
Again, nothing. I had attempted the suggested ‘brew reinstall postgresql’ but that hadn’t proved fruitful either.
Eventually after various attempts to update and install node, I found the solution to be the following:
brew upgrade postgresql
brew services restart postgresql
Oh my beautiful log.
Up goes my server, away goes my lag, and apparently it’s now the afternoon. Great.
There are a few helpful Stackoverflow posts on this particular matter which I link to below. Hopefully if this happens to you then I’ve helped you find a quick remedy.