homebrew學習(五)之homebrew cask和homebrew services


homebrew cask

如果我想安裝Chrome瀏覽器怎么辦?試試下面的命令:

brew install google-chrome

發現並不能安裝,沒有該軟件。怎么辦?好消息是一個叫做homebrew-cask的工具擴充了homebrew。

Homebrew cask 軟件倉庫,提供 macOS 應用和大型二進制文件

安裝

brew install caskroom/cask/brew-cask

使用

基本用法與brew相同,只不過在brew后面加了一個cask單詞。

安裝軟件

brew cask install google-chrome

卸載軟件

brew cask uninstall google-chrome

homebrew services

如果我們使用homebrew安裝了mysql等服務我們如何來管理呢?

Homebrew Services是一套可以通過 launchctl來管理安裝的服務的套件

macOS使用launchctl命令加載開機自動運行的服務,brew service可以簡化lauchctl的操作。

以MySQL為例,使用launchctl啟動:

ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

如使用brew service可以簡化為:

brew services start mysql

安裝

brew install services

⚠️實際上homebrew services會在運行時自動安裝

使用(都以mysql為例)

查看所有命令 

brew services

start

登錄時啟動mysql服務

brew services start mysql

在啟動時啟動Dnsmasq服務

sudo brew services start dnsmasq

啟動所有可用的服務

brew services start --all

run

運行服務,但不要在登錄時啟動它

brew services run mysql

stop

停止服務

brew services stop mysql

restart

重啟服務

brew services restart mysql

list

列出homebrew services管理的所有服務(查看使用homebrew安裝的所有服務的列表)

brew services list

cleanup

刪除所有未使用的服務

brew services cleanup

參考

homebrew-services


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM