Fork me on GitHub

Mac下安装brew

    本次安装brew主要是为了平时安装其他软件时方便一些,原来也一直知道有这个东西,看有的人说brew下载的东西可能不是最新版,并且也习惯了上官网下载tar包然后自己解压编译,所以一直没有选择用brew安装软件,这次也是想安装尝试使用一下。

1.安装

    看网上的安装方法都是用curl,我也是复制到终端,然后回车,结果报错 请求超时

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out

   然后自己试了一下这个链接  https://raw.githubusercontent.com/Homebrew/install/master/install   发现打不开,可能是网络原因,因为公司的网有时候会限速(但也不至于这么慢吧),所以我用手机开了一个热点,再点击就可以访问了,如果遇到上面的问题,首先要保证这个网站能访问。

访问成功效果:

2.安装 Command Line Tools for Xcode

    可以成功访问后,开始再次输入命令:  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

然后就开始安装  中间会让你输入密码 或 按回车,本以为这样就成功了,结果一直卡在Downloading Command Line Tools for Xcode...   刚开始还以为是网慢,结果等了半天报错安装失败,

难道还要专门下一个Xcode?后来百度发现命令行工具可以独立安装,不必安装Xcode,那我直接去安装一个这个工具不就行了,当然如果你直接安装成功了那自然是最好。

复制到浏览器:https://developer.apple.com/download/more/ (苹果官网),登录一下自己的Apple账号,搜索 "Command Line Tools for Xcode" ,其中最新的两个11版本的需要mac系统版本在10.14.4以上,本来想下新版本的,结果下载下来发现不能用,因为系统最近一直没有更新,所以是10.14.3....,心疼我的流量啊,下载哪个还是要看你自己的系统版本了,我是下载的这个8.3.2的,虽然不是最新的,但是用着暂时没有发现什么问题。

 

    下载、同意协议,然后安装即可

    大约有1G多吧,反正比下个Xcode小很多,

    然后再次返回终端,输入刚开始输入的下载命令:

#输入:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 124504 (delta 12), reused 15 (delta 2), pack-reused 124469
Receiving objects: 100% (124504/124504), 29.46 MiB | 108.00 KiB/s, done.
Resolving deltas: 100% (91220/91220), done.
From https://github.com/Homebrew/brew
...
...
#后面下载Homebrew的时候有点慢,可能还是我的网络问题吧,稍等一会儿后
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 5017, done.
remote: Counting objects: 100% (5017/5017), done.
remote: Compressing objects: 100% (4802/4802), done.
remote: Total 5017 (delta 52), reused 1063 (delta 24), pack-reused 0
Receiving objects: 100% (5017/5017), 4.02 MiB | 92.00 KiB/s, done.
Resolving deltas: 100% (52/52), done.
Checking out files: 100% (5035/5035), done.
Tapped 2 commands and 4805 formulae (5,060 files, 12.5MB).
Already up-to-date.
==> Installation successful!  #安装成功

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

 

  

 3.测试brew

    最后可以在终端中测试一下命令,先测试一下刚才安装的xcode命令行,输入xcode-select -h(查看帮助命令)

 

 

    然后在测试一下brew,还是输入查看帮助命令 brew help

到此brew安装成功,也是给自己以后安装东西增加了一种选择方式。

 

posted @ 2019-06-27 11:11  黄焖鸡米饭-  阅读(42228)  评论(5编辑  收藏  举报