无法在 Mac OS 中启动时加载 postgresql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26334414/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:39:08  来源:igfitidea点击:

Can't make postgresql load at startup in Mac OS

macospostgresqlservicepostgresql-9.3launchd

提问by Ha Pham

I have installed postgresqlvia HomeBrew. It worked but today I find that postgresqlserver does not run when computer start.

我已经postgresql通过HomeBrew. 它有效,但今天我发现postgresql计算机启动时服务器没有运行。

I try to use launchctlto load it again with below command:

我尝试使用launchctl以下命令再次加载它:

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

and I see the message:

我看到消息:

/usr/local/Cellar/postgresql/9.3.4/homebrew.mxcl.postgresql.plist: Service is disabled

I do not know how to enable postgresql service. Could anyone show me?

我不知道如何启用 postgresql 服务。谁能给我看看?

回答by Parag Bafna

Use -woption with launchctl.

-w选项与launchctl.

$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 

-wOverrides the Disabled key and sets it to false.

-w覆盖 Disabled 键并将其设置为 false。

回答by KARASZI István

The new way as brew info postgresqlsays:

新方法如brew info postgresql说:

brew services start postgresql

回答by gards

It might also be helpful to use the command brew info postgresqlfor suggestions about how to set up your database and move the plist file into ~/Library/LaunchAgents

使用该命令brew info postgresql获取有关如何设置数据库并将 plist 文件移入的建议也可能会有所帮助~/Library/LaunchAgents