开发者

PostgreSQL permissions issue after upgrading to OS X Lion

开发者 https://www.devze.com 2023-03-22 21:05 出处:网络
After upgrading to Lion, I get the following error when trying to start up the Postgres server: pg_ctl: could not open PID file \"/usr/local/var/postgres/postmaster.pid\": Permission denied

After upgrading to Lion, I get the following error when trying to start up the Postgres server:

pg_ctl: could not open PID file "/usr/local/var/postgres/postmaster.pid": Permission denied

I also tried to re-run the initdb command, but ran into a similar problem:

initdb: could not access directory "/usr/local/var/postgres": Permission denied

If it matters, PostgreSQL was installed via Homebrew. Running brew info postgresql yields the exp开发者_开发知识库ected results (version, summarized docs).


Well, it turns out the solution was pretty simple. I changed the group on /usr/local/var to staff (from wheel) and changed the ownership (chown -R) to my system account (from root).

After that, postgres started up fine.

I was a little nervous changing those permissions, but the only thing in my /usr/local/var was a postgres directory, so all should be well. If you have other directories/files in /usr/local/var, maybe don't use the -R flag when chown'ing?

The Homebrew ruby installer script changes the group of /usr/local/var to staff, so that must have gotten undone when upgrading to Lion. Not sure about the ownership being root instead of my system account though...


sudo chown -R $(whoami) /usr/local/var

0

精彩评论

暂无评论...
验证码 换一张
取 消