mac安裝brew 軟件包管理工具Homebrew


brew 全稱Homebrew  是Mac OSX上的軟件包管理工具

Homebrew 安裝和卸載工具 只用一行命令就能完成

官方地址:    http://brew.sh/index.html

 

 
mac 自帶ruby    
打開命令行  terminal  
輸入  :
[java]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. ruby -version  
 

1) 安裝命令  

 
[java]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"  

假如已經安裝了  輸入如下命令
 
[java]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  

命令行輸出:
 
 

2) brew 使用方法

命令行 輸入:  brew

 

輸出:

 

[java]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. Example usage:  
  2.   brew [info | home | options ] [FORMULA...]  
  3.   brew install FORMULA...  
  4.   brew uninstall FORMULA...  
  5.   brew search [foo]  
  6.   brew list [FORMULA...]  
  7.   brew update  
  8.   brew upgrade [FORMULA...]  
  9.   brew pin/unpin [FORMULA...]  
  10.   
  11. Troubleshooting:  
  12.   brew doctor  
  13.   brew install -vd FORMULA  
  14.   brew [--env | config]  
  15.   
  16. Brewing:  
  17.   brew create [URL [--no-fetch]]  
  18.   brew edit [FORMULA...]  
  19.   open https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md  
  20.   
  21. Further help:  
  22.   man brew  
  23.   brew home  

 

 

3) 安裝工具

 

舉個栗子:   wget  這個工具

輸入命令:   brew install wget 

如圖:

 

 

4)  卸載

拿上面的栗子:   wget 工具

輸入命令    brew uninstall wget

 

5)  工具安裝的目錄

Homebrew 會將套件安裝到獨立目錄,並將文件軟鏈接至/usr/local 。

 

[java]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. $ cd /usr/local  
  2. $ find Cellar  
  3. Cellar/wget/1.16.1  
  4. Cellar/wget/1.16.1/bin/wget  
  5. Cellar/wget/1.16.1/share/man/man1/wget.1  
  6.   
  7. $ ls -l bin  
  8. bin/wget -> ../Cellar/wget/1.16.1/bin/wget  

 

 

 
 
Homebrew 的所有文件均會被安裝到預定義目錄下,所以無需擔心 Homebrew 的安裝位置。

 

 

6) 其他命令

 

brew list           列出已安裝的軟件

brew update     更新brew

brew home       用瀏覽器打開brew的官方網站

brew info         顯示軟件信息

brew deps        顯示包依賴

 

      更多命令請看:    https://git.io/brew-docs


免責聲明!

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



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