Mac OS下包管理器brew的安装与使用

1,708 阅读1分钟
先检测mac是否安装有brew 终端命令行输入:


  brew 

会提示:

-bash: ~brew: command not found 

这说明还未安装brew。

 ###安装

 1.安装XCode或者Command Line Tools for Xcode。如果你使用XCode来进行软件的开发,那么只需要在App Store中安装Xcode即可。如果你并不使用Xcode这个庞然大物来编码,那么可以安装Command Line Tools for Xcode:打开终端,键入以下代码完成安装: 

 xcode-select --install 

我之前安装过了,所以提示


2.安装完上面的编译依赖之后,通过下面的代码完成Homebrew的安装: 

 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

然后会提示

 Press RETURN to continue or any other key to abort

点击回车,输入密码进行下一步 然后就静静等待了, 如下图提示安装成功, 

![image.png](https://upload-images.jianshu.io/upload_images/6113773-6b056f326f9f5b1c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 

然后再输入 

 brew   

就能看到使用示例

 ![image.png](https://upload-images.jianshu.io/upload_images/6113773-6cb07dcd74ad4836.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)  

更多使用的方法请参考官网 [Homebrew的官网](https://link.jianshu.com/?t=http://brew.sh/index_zh-cn.html)