PostgreSQL: postgres does not know where to find the server configuration file.

I am trying to configure postgreSQL as my local development database.

when i run

brew install postgres

I get the following error:

 postgresql-9.3.5 already installed

In my gemfile, I have pg in the list of gems.

When i started

rake db:create:all

I get the following error:

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"?

My database.yml is as follows:

development:
  adapter: postgresql
  encoding: unicode
  database: fls_development
  host: localhost
  pool: 5
  port: 5432

# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: postgresql
  database: fls_test
  pool: 5
  timeout: 5000

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5

same as this post: How to set up a PostgresSQL server on MacOS 10.8.5? I get the following error when I just typpostgres

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.

I am confused because the solution to the aforementioned SO post recommends installing using Homebrew, but I'm sure that is how I installed it.

+4
source share
2 answers

, , brew uninstall postgresql, PostgreSQL, 5432.

+2

,

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

All Articles