美文网首页
mac 下 homebrew 启动服务

mac 下 homebrew 启动服务

作者: suri_song | 来源:发表于2018-03-08 15:16 被阅读0次

关于brew的隐藏命令:http://icyleaf.com/2014/01/homebrew-hidden-commands/

安装homebrew:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew安装软件:brew install software(mysql,postgresql...),这些服务安装在/usr/local/opt

在max os 中,这些服务被.plist后缀的文件代表,plist文件通常存储在 ~/Library/LaunchAgents 或者/Library/LaunchAgents中,举例来说:当你需要加载mysql时:

ln  -sfv  /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents/

launchctl  load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

注:launchctl是一个统一的服务管理框架,可以启动、停止和管理守护进程、应用程序、进程和脚本等。ln命令用来为文件创件连接,连接类型分为硬连接和符号连接两种,默认的连接类型是硬连接。如果要创建符号连接必须使用"-s"选项。

或者你不想使用launchctl命令,你可以运行

mysql.server start

而以上步骤太过于耗费时间,同时也记不住homebrew plist的存放位置。很庆幸,homebrew提供了一个借口来控制而并不需要ln launchctl,ln或者需要知道plist的存放位置。

brew services 安装:

brew tap homebrew/services

启动服务等

brew services start mysql

brew services restart mysql

brew services restart mysql

brew services list

相关文章

网友评论

      本文标题:mac 下 homebrew 启动服务

      本文链接:https://www.haomeiwen.com/subject/pslyfftx.html