We've moved discussions to Discord

Pg is not connecting to the local server (!)

Jose Balaguer
Hi Chris Oliver . I still can't run my copy locally on Mac OS Big Sur. 

On the terminal the app seems to start (foreman start) without errors but the browser gives this one:
PG::ConnectionBad (could not connect to server: No such file or directory
18:53:09 web.1     | Is the server running locally and accepting
18:53:09 web.1     | connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
18:53:09 web.1     | ):
18:53:09 web.1     |
18:53:09 web.1     | pg (1.1.4) lib/pg.rb:56:in `initialize'
18:53:09 web.1     | pg (1.1.4) lib/pg.rb:56:in `new'
18:53:09 web.1     | pg (1.1.4) lib/pg.rb:56:in `connect'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:889:in `new_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:933:in `checkout_new_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:912:in `try_to_checkout_new_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:873:in `acquire_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:595:in `checkout'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:439:in `connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:1121:in `retrieve_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_handling.rb:238:in `retrieve_connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/connection_handling.rb:206:in `connection'
18:53:09 web.1     | activerecord (6.0.1) lib/active_record/migration.rb:562:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
18:53:09 web.1     | activesupport (6.0.1) lib/active_support/callbacks.rb:101:in `run_callbacks'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
18:53:09 web.1     | web-console (4.0.1) lib/web_console/middleware.rb:132:in `call_app'
18:53:09 web.1     | web-console (4.0.1) lib/web_console/middleware.rb:28:in `block in call'
18:53:09 web.1     | web-console (4.0.1) lib/web_console/middleware.rb:17:in `catch'
18:53:09 web.1     | web-console (4.0.1) lib/web_console/middleware.rb:17:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
18:53:09 web.1     | turbolinks_render (0.9.16) lib/turbolinks_render/middleware.rb:77:in `call'
18:53:09 web.1     | railties (6.0.1) lib/rails/rack/logger.rb:38:in `call_app'
18:53:09 web.1     | railties (6.0.1) lib/rails/rack/logger.rb:26:in `block in call'
18:53:09 web.1     | activesupport (6.0.1) lib/active_support/tagged_logging.rb:80:in `block in tagged'
18:53:09 web.1     | activesupport (6.0.1) lib/active_support/tagged_logging.rb:28:in `tagged'
18:53:09 web.1     | activesupport (6.0.1) lib/active_support/tagged_logging.rb:80:in `tagged'
18:53:09 web.1     | railties (6.0.1) lib/rails/rack/logger.rb:26:in `call'
18:53:09 web.1     | sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
18:53:09 web.1     | rack (2.0.7) lib/rack/method_override.rb:22:in `call'
18:53:09 web.1     | rack (2.0.7) lib/rack/runtime.rb:22:in `call'
18:53:09 web.1     | activesupport (6.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/static.rb:126:in `call'
18:53:09 web.1     | rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
18:53:09 web.1     | actionpack (6.0.1) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
18:53:09 web.1     | webpacker (4.2.0) lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
18:53:09 web.1     | rack-proxy (0.6.5) lib/rack/proxy.rb:57:in `call'
18:53:09 web.1     | railties (6.0.1) lib/rails/engine.rb:526:in `call'
18:53:09 web.1     | puma (4.3.6) lib/puma/configuration.rb:228:in `call'
18:53:09 web.1     | puma (4.3.6) lib/puma/server.rb:713:in `handle_request'
18:53:09 web.1     | puma (4.3.6) lib/puma/server.rb:472:in `process_client'
18:53:09 web.1     | puma (4.3.6) lib/puma/server.rb:328:in `block in run'
18:53:09 web.1     | puma (4.3.6) lib/puma/thread_pool.rb:134:in `block in spawn_thread'

I've seen is a postgres-rails6 known issue but nobody has a proper solution that works on Big Sur.

Is a big problem because I can't work locally until this get fixed. 
Any help will be appreciated.
Joe Tebaldi
Hey  Jose Balaguer - did you try deleting the postmaster.pid file and restarting postgres? 

$ rm /usr/local/var/postgres/postmaster.pid
$ brew services restart postgresql

You may have to edit that path (if your postgres folder structure is different) but this solution worked for me so thought I'd share
Jose Balaguer
I've already tried this but there is no such file in that path nor on /usr/local/var/postgresql@11
Thanks for the idea Joe Tebaldi  
Chris Oliver
We've been discussing this one over email. Looks like his Postgresql data directory isn't able to be ready. Something may have gotten messed up in a upgrade with Homebrew somewhere. Not sure. My Postgres databases were fine after upgrading to Big Sur.
Wakgari Baja
I had same exact problem. can you check the port your pg is running locally ? /etc/postgresql/12/main/postgresql.conf. make sure it matches. 
Sunny Dasgupta
I'm also having the same issue. Has anyone found a solution to this? Restarting postgres didnt work for me 
Sunny Dasgupta
Found a solution to this, but I had to delete all data and get a fresh database. This deleted my local data not just from the current rails project but also all the others, which wasn't too much of an issue for me but might be for others. 
rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8
Then run:
rails db:create
rails db:migrate
Notifications
You’re not receiving notifications from this thread.