Web Development
PG::ConnectionBad (could not connect to server: Connection refused
	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?
)

This is something that most likely resulted when a PostgreSQL server was updated but the databases weren’t updated to the current version.

Here is a simple fix that could help you.

brew postgresql-upgrade-database

 brew postgresql-upgrade-database
==> brew install postgresql@10
==> Downloading https://homebrew.bintray.com/bottles/postgresql@10-10.10_1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0b/0bfd1011bd9500221b4213c86699a13c692acdf41984e88a1b86f2397ea11f15?__gda__=exp=1568557647~hmac=02a02995ee6bde2ee4d6871f6974b36d
######################################################################## 100.0%
[......]
==> Upgraded postgresql data from 10 to 11!
==> Your postgresql 10 data remains at /usr/local/var/postgres.old
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

Everything would hopefully be working for you too!