Trying to setup postgres on OSX
macos, postgresql
Solution
I had a similar issue on my new MacBook Pro running Mountain Lion. I downloaded the PostgresApp and when I fired up rails I received the following error:
`initialize': could not connect to server: No such file or directory (PG::Error)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
To fix this I had to explicitly define the host and port in my `database.yml` file like so:
development:
adapter: postgresql
encoding: unicode
database: my_app_development
pool: 5
username: tony
password: stark
host: localhost
port: 5432
Problem
I am trying to get postgres setup locally for a rails app on my mac (10.7 Lion). I installed postgresapp and launched it, I now have an elephant in my status bar telling me that postgres is running. I can get to it by: ``` psql -h localhost ``` But when I simply run `psql` I get this error: psql: could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? I put this: ``` PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH" ``` In `~/.bashrc` and opened a new terminal. But no dice. When I run `which psql` I get `/usr/bin/psql` Not really sure what to do.. I am still pretty new to unix systems. Should I symlink `/usr/bin/psql` to `/Applications/Postgres.app/Contents/MacOS/bin/psql`?