Bobs-MacBook-Pro-2:~ bobhannan$ brew services start mongodb
Error: Unknown command: services
Bobs-MacBook-Pro-2:~ bobhannan$ brew services list
Error: Unknown command: services
使用服务而不是服务也有问题。
答案1
没有名为 的命令brew services
。
这些存在:
brew install
brew uninstall
brew search
brew list
brew update
brew upgrade
brew pin/unpin
brew doctor
brew install -vd
brew --env | config
brew create URL --no-fetch
brew edit
您可以使用以下方式安装它:
curl -o /usr/local/bin/brew-services.rb https://gist.githubusercontent.com/lwe/766293/raw/75a7907004bbff0eb3b072d1d951be2cfe7e5020/brew-services.rb
chmod +x /usr/local/bin/brew-services.rb
brew services help
答案2
首先,通过点击 homebrew/boneyard (一次)来安装brew服务:
brew tap homebrew/boneyard
注意:设置launchctl自动启动mongo
$ launchctl 加载 ~/Library/LaunchAgents/homebrew.mxcl.mongo.plist $ launchctl 卸载 ~/Library/LaunchAgents/homebrew.mxcl.mongo.plist
来源 :http://robots.thoughtbot.com/starting-and-stopping-background-services-with-homebrew