I am having basic problems using PostgreSQL on my Mac OSX Yosemite, through the terminal. I tried google-ing but this is becoming increasingly difficult and info very scattered so I keep running into walls.
I did the following:
- installed PostgreSQL 9.5.2 via Homebrew
- modified my shell config file (.zshrc) to include PostgreSQL bin directory in $PATH variable
- I did the "initdb" routine and "told" Postgres that I want to store my databases in
/usr/local/cellar/postgresql/9.5.2/data
Here I tried starting postgreSQL:
$pg_ctl /usr/local/cellar/postgresql/9.5.2/data -l logfile start
first error:
pg_ctl: another server might be running; trying to start server anyway
/bin/sh: logfile: Permission denied
As far as I understand, I am trying to start the PostgreSQL server and direct its output and errors into a log file, located in a location for which my user has no write privileges.
How can I fix this?
Here I tried stopping the server and try again:
$pg_ctl -D /usr/local/cellar/postgresql/9.5.2/data stop
This worked ok. So,
- How can I use other location to start the server and enable log
- How do I check if the server is running if I need to stop it (if errors appear)?