title: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
body: <p>I'm working on a rails4 app.</p>
  
  <p>A colleague of mine recently changed the database we use to postgress. When I pulled his branch and try to run my server I get the following error:</p>
  
  <pre><code>could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
  </code></pre>
  
  <p>This is my database.yml</p>
  
  <pre><code>default: &amp;default
    adapter: postgresql
    encoding: unicode
    pool: 5
  
  development:
    &lt;&lt;: *default
    database: sciencevest_development
  
  test:
    &lt;&lt;: *default
    database: sciencevest_test
  
  production:
    &lt;&lt;: *default
    database: sciencevest_production
    username: sciencevest
    password: &lt;%= ENV['SCIENCEVEST_DATABASE_PASSWORD'] %&gt;
  </code></pre>
  
  <p>Gemfile:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '4.2.2'
  # Use sqlite3 as the database for Active Record
  gem 'pg'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.1.0'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  # gem 'therubyracer', platforms: :ruby
  
  # Bootstrap &amp; sass
  gem 'bootstrap-sass', '~&gt; 3.3.5'
  gem 'sass-rails', '&gt;= 3.2'
  
  
  # Use jquery as the JavaScript library
  gem 'jquery-rails'
  # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
  gem 'turbolinks'
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.0'
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', '~&gt; 0.4.0', group: :doc
  
  # authentication
  gem 'devise'
  gem 'devise_invitable'
  
  # authorization
  gem 'pundit'
  
  # roles
  gem 'rolify'
  
  # states
  gem 'aasm'
  # pretty development data
  gem 'faker'
  
  # uploading images &amp; videos
  gem 'carrierwave'
  
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # Use Unicorn as the app server
  # gem 'unicorn'
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  source 'https://rails-assets.org' do
    gem 'rails-assets-bootstrap'
  end
  
  group :development, :test do
  
    # test suite
    gem 'minitest-rails'
    gem 'factory_girl_rails', '4.0'
  
    # guards
    gem 'guard'
    gem 'guard-minitest'
    gem 'database_cleaner'
  
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
    gem 'byebug'
  
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; in views
    gem 'web-console', '~&gt; 2.0'
  
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
    gem 'spring'
  end
  
  group :development do 
  
    gem 'guard-livereload'
  end
  </code></pre>
  
  <p>When I run  <code>ps auwwx|grep postg</code> I get this:</p>
  
  <pre><code>c5227806        42095   0.0  0.0  2432772    648 s001  S+    5:47PM   0:00.00 grep postg
  </code></pre>
  
  <p>I also have this:</p>
  
  <pre><code>$ psql --version
  psql (PostgreSQL) 9.4.4
  </code></pre>
  
  <p>And this(i dont know if they are different):</p>
  
  <pre><code>$ postgres -V
  postgres (PostgreSQL) 9.4.4
  </code></pre>
  
  <p>Also this:</p>
  
  <pre><code>$ brew info postgres
  postgresql: stable 9.4.4 (bottled)
  Object-relational database system
  https://www.postgresql.org/
  Conflicts with: postgres-xc
  /usr/local/Cellar/postgresql/9.4.4 (3014 files, 40M) *
    Poured from bottle
  From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/postgresql.rb
  ==&gt; Dependencies
  Required: openssl ✔, readline ✔
  ==&gt; Options
  --32-bit
      Build 32-bit only
  --with-dtrace
      Build with DTrace support
  --with-python
      Build with python support
  --without-perl
      Build without Perl support
  --without-tcl
      Build without Tcl support
  ==&gt; Caveats
  If builds of PostgreSQL 9 are failing and you have version 8.x installed,
  you may need to remove the previous version first. See:
    https://github.com/Homebrew/homebrew/issues/2510
  
  To migrate existing data from a previous major version (pre-9.4) of PostgreSQL, see:
    https://www.postgresql.org/docs/9.4/static/upgrading.html
  
  
  To have launchd start postgresql at login:
      ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
  Then to load postgresql now:
      launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  Or, if you don't want/need launchctl, you can just run:
      postgres -D /usr/local/var/postgres
  c5227806 at PALM00566449A in ~/desktop/dev_projects/rails_projects/sciencevest on carrierwave
  $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  /Users/c5227806/Library/LaunchAgents/homebrew.mxcl.postgresql.plist: No such file or directory
  </code></pre>
  
  <p>Any ideas? All the explanations I found online either didn't work or were too complicated to understand.</p>