在末尾的说明安装启动PostgreSQL,请提供一个解决方案时,在用户登录:使用Homebrew安装自动启动PostgreSQL的正确方法是什么?
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
我希望,如果我把plist中在/ Library/LaunchAgents /相反,它会启动,而无需等待让我登录。不幸的是,这不是它的工作原理。我没有找到好的plist编辑指令,我真的害怕尝试修补它。我猜测问题在于用户名密钥,但我不想删除它,只是希望它的工作。
这是生成的plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.postgresql</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/postgres</string>
<string>-D</string>
<string>/usr/local/var/postgres</string>
<string>-r</string>
<string>/usr/local/var/postgres/server.log</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>my_username</string>
<key>WorkingDirectory</key>
<string>/usr/local</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/postgres/server.log</string>
</dict>
</plist>
原来,解决方案与将plist移动到LaunchDaemons而非LaunchAgents一样简单。 – burger 2012-03-20 03:28:47