一,安裝brew
1,安裝brew
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
2,安裝完成後執行
brew
提示:Please run brew update!
3,按照提示更新,執行
brew update
報錯:Error: /usr/local must be writable!
4,賦給/usr/local目錄權限,執行sudo chown -R $(whoami) /usr/local
sudo chown -R fxp /usr/local
其中fxp爲系統當前用戶名。
5,再次執行
brew update
二、brew常用命令
brew –help
安裝軟件
brew install git
卸載軟件
brew uninstall git
搜索軟件
brew search git
顯示已經安裝軟件列表
brew list
更新軟件,把所有的Formula目錄更新,並且會對本機已經安裝並有更新的軟件用*標明。
brew update
更新某具體軟件
brew upgrade git
查看軟件信息
brew [info | home] [FORMULA...]
刪除程序,和upgrade一樣,單個軟件刪除和所有程序老版刪除。
brew cleanup git
brew cleanup
查看那些已安裝的程序需要更新
brew outdated
其它Homebrew指令:
brew list —列出已安裝的軟件
brew update —更新Homebrew
brew home *—用瀏覽器打開
brew info *—顯示軟件內容信息
brew deps * — 顯示包依賴
brew server * —啓動web服務器,可以通過瀏覽器訪問http://localhost:4567/ 來同網頁來管理包
brew -h brew —幫助
homebrew本身就是一個git倉庫。使用homebrew安裝軟件包時,會自動先下載軟件包,然後解壓安裝,但有時候下載會卡住,或者很慢,這個時候你可以通過其他工具先將所需的軟件包下載 下來,注意版本一定要對應,homebrew放置軟件包源碼的路徑爲/Library/Caches/Homebrew/,只要你將所需要的軟件包下載正 確的版本,放置在此目錄下,那麼再使用brew install xxx的時候,brew就能直接安裝了,有時候brew install xxx卡在下載界面,這招很管用。
Making a formula is easy. Just brew create URL
and then brew install $FORMULA
(perhaps with --debug --verbose
). Basically, a formula is a Ruby file. You can place it anywhere you want (local or remote) and install it by pointing to the file or URL.
formula文件位置:/usr/local/Library/Formula/foo.rb 存放安裝工具的rb文件