After updating to Yosemite 10.10 I cannot connect to my postgresql database. I run the rails console and try and get the first user but get this error...
> ➜ game_golf git:(master) ✗ rails c
> Loading development environment (Rails 4.1.4)
> [1] pry(main)> User.first
> 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?
> from /Users/pauldornfeld/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
> [2] pry(main)>
What do I do! I have tried to reinstall postgresql, reinstall homebrew. Please help!
You are better off using the easy method by installing the http://postgresapp.com/ app! I too had this same issue with 10.9.4. Also with 10.10.
brew install postgres
will give issues when doing any OS X upgrades so avoid it. So install the app then:
Add this to your profile if the install do not work out of the box. For me I never had to add the below in my profile:
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
This line must be at the top of your profile:
export PATH=/usr/local/bin:$PATH
Good luck!