608.620.5104 | info@tenforward.consulting
Psst! We're hiring!

Our inclusive, feminist office is looking to hire for the following position:

Learn more about the job at our careers page, and learn more about Ten Forward as a company on our mission and vision page and about us page! 

How to kickstart PostgreSQL

Published February 17, 2016
Found at http://www.seibertron.com/; credit to Hasbro,
Sunbrow Productions and Marvel Productions

 

Had to hard boot my Mac for the second time this week and got an error running Rails server:

Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting TCP/IP connections on port 5432?


This happens because postgres isn't running (duh). If you installed Postgres via Homebrew (like you should have), then brew info postgresql will tell you to run this command to start Postgres:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist


Fact of the matter is that the machine had to be hard rebooted because it's a piece of shit, so if you try to do this it will execute and then fail silently. If you have the prescience to look at the log file, it's pretty obvious that it thinks the server is still running because of the presence of a pid file. Get rid of that file and you can be on your way, but be sure to psych out launchctl first:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
rm /usr/local/var/postgres/postmaster.pid 
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Author details

Brian Samson

President
@samsonasu