Homebrew简称brew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件,可以说Homebrew就是mac下的apt-get、yum神器
工具/原料
mac os x
Homebrew
安装homebrew
1、获取 Homebrew1.打开终端2.复制粘贴下面代码获取homebrew/usr/bin/ruby -e "$(curl 幻腾寂埒-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"3.输入命令后会出现如下提示,回车继续安装,提示输入电脑密码是输入,好了直到安装完毕。
2、卸载homebrewruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
homebrew使用
1、查看版本:brew -v下载软件:brew install 软件名如:brew install htop , 安装htop;如需要图形安装的软件 要加cask:brew install caskroom/cask/brew-cask(brew install cask)如:brew cask install google-chrome
2、卸载软件:brew uninstall 软件名如: brew cask uninstall google-chrome , 卸载chrome浏览器;
3、软件搜索:brew search 软件名如: brew search google支持正则表达式:brew search /vi/(搜索以vi开头的软件)
4、列出已安装的包:brew list列出过时的包:brew outdated
5、查看软件相关信息:brew info 软件名如:brew info google-chrome
6、删除 Homebrew下载的包:brew cleanup更新 Homebrew:brew update
homebrew 扩展使用
1、mac命令自动补全1.安装了 bash-completion:brew install completion2.brew info bash-completion 显示结果复制最后两行:Add the following lines to your ~/.bash_profile:[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion3.创建.bash_profile:touch .bash_profile4.编辑.bash_profile:vim .bash_profile 把刚刚复制的粘贴进去,保存退出
2、homebrew扩展仓库:列出已有仓库:brew tap添加仓库:brew tap 仓库名删除仓库:brew untap 仓库名
homebrew更新源
1、git仓库源1.龅歧仲半打开终端2.输入下列命令cd /usr/local/Homebrewgit remote set-url origin 茑霁酌绡http://mirrors.ustc.edu.cn/homebrew.gitcd ~mkdir tmpcd tmpgit clone http://mirrors.ustc.edu.cn/homebrew.gitcp -R homebrew/.git /usr/local/Homebrewcp -R homebrew/Library /usr/local/Homebrew
2、服务器地址源1.打开终端2.输入下列命令echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrcsource ~/.zshrc