brew 又叫Homebrew,是Mac OSX上的軟件包管理工具,能在Mac中方便的安裝軟件或者卸載軟件, 只需要一個命令, 非常方便
brew類似ubuntu系統下的apt-get的功能
安裝brew
brew 的官方網站: http://brew.sh/ 在官方網站對brew的用法進行了詳細的描述
安裝方法: 在Mac中打開Termal: 輸入命令:
# ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
使用brew安裝軟件
一個命令就搞定了
安裝git
# brew install git
安裝wget
# brew install wget
使用brew卸載軟件
# brew uninstall wget
使用brew查詢軟件
比如查詢wget
# brew search /wge*/ : /wge*/是個正則表達式, 需要包含在/中
其他brew命令
# brew list //列出已安裝的軟件
# brew update //更新brew
# brew home //用瀏覽器打開brew的官方網站
# brew info //顯示軟件信息
# brew deps //顯示包依賴
brew源改成清華的源
# git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git # git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git # git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git # brew update
brew源改成aliyun的源
# git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git # git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git # git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.aliyun.com/git/homebrew/homebrew-cask.git # brew update
如果想還原brew源
# git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git # git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git # git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git # brew update