zsh下brew安装

之前brew安装的方式发生了变化,memo一下现在的国内镜像的安装方式。

现象

liumiao@liumiaodeMacBook-Pro ~ % ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Traceback (most recent call last):
-e:1:in `<main>': undefined local variable or method `“”' for main:Object (NameError)
liumiao@liumiaodeMacBook-Pro ~ % 

安装方式

使用如下命令即可

安装命令:bin/zsh -c “$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”

执行日志如下:

liumiao@liumiaodeMacBook-Pro ~ % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

               开始执行Brew自动安装程序 
              [cunkai.wang@foxmail.com] 
           ['2021-03-19 23:20:02']['11.1']
        https://zhuanlan.zhihu.com/p/111014448 


请选择一个下载镜像,例如中科大,输入1回车。
源有时候不稳定,如果git克隆报错重新运行脚本选择源。cask非必须,有部分人需要。
1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源  4、腾讯下载源(不显示下载进度) 5、阿里巴巴下载源(缺少cask源)  

请输入序号: 1


  你选择了中国科学技术大学下载源
  
!!!此脚本将要删除之前的brew(包括它下载的软件),请自行备份。
->是否现在开始执行脚本(N/Y) Y

--> 脚本开始执行
 Mac os设置开机密码方法:
  (设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)
  (如果提示This incident will be reported. 在用户与群组中查看是否管理员) 
==> 通过命令删除之前的brew、创建一个新的Homebrew文件夹
请输入开机密码,输入过程不显示,输入完后回车
Password:
开始执行
-> 创建文件夹 /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
此步骤成功
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown liumiao /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew
git version 2.24.3 (Apple Git-128)

下载速度觉得慢可以ctrl+c或control+c重新运行脚本选择下载源
==> 克隆Homebrew基本文件

未发现Git代理(属于正常状态)
Cloning into '/usr/local/Homebrew'...
remote: Enumerating objects: 184485, done.
remote: Total 184485 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (184485/184485), 46.84 MiB | 9.20 MiB/s, done.
Resolving deltas: 100% (137690/137690), done.
此步骤成功
--创建Brew所需要的目录
运行代码 ==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/bin /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig
运行代码 ==> /usr/bin/sudo /usr/sbin/chown liumiao /usr/local/bin /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /usr/sbin/chown liumiao /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R liumiao:admin /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /Users/liumiao/Library/Caches/Homebrew
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /Users/liumiao/Library/Caches/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R liumiao /Users/liumiao/Library/Caches/Homebrew
--依赖目录脚本运行完成
==> 创建brew的替身
==> 克隆Homebrew Core
此处如果显示Password表示需要再次输入开机密码,输入完后回车
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 928345, done.
remote: Total 928345 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (928345/928345), 363.72 MiB | 9.89 MiB/s, done.
Resolving deltas: 100% (636454/636454), done.
此步骤成功
==> 克隆Homebrew Cask 图形化软件
  此处如果显示Password表示需要再次输入开机密码,输入完后回车
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 606686, done.
remote: Total 606686 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (606686/606686), 252.07 MiB | 8.31 MiB/s, done.
Resolving deltas: 100% (433028/433028), done.
此步骤成功
==> 配置国内镜像源HOMEBREW BOTTLE
sed: /Users/liumiao/.zprofile: No such file or directory
环境变量写入->/Users/liumiao/.zprofile
此步骤成功
电脑系统版本:11.1
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown liumiao /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew

==> 安装完成,brew版本

Homebrew 3.0.7-42-g97d4527-dirty
Homebrew/homebrew-core (git revision 2eb8ff39e4; last commit 2021-03-19)
Homebrew/homebrew-cask (git revision b8f8961cb5; last commit 2021-03-19)
Brew前期配置成功

==> brew update

==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
Already up-to-date.

        Brew自动安装程序运行完成
          国内地址已经配置完成

  桌面的Old_Homebrew文件夹,大致看看没有你需要的可以删除。

              初步介绍几个brew命令
本地软件库列表:brew ls
查找软件:brew search google(其中google替换为要查找的关键字)
查看brew版本:brew -v  更新brew版本:brew update
安装cask软件:brew install --cask firefox 把firefox换成你要安装的
        
        欢迎右键点击下方地址-打开URL 来给点个赞
         https://zhuanlan.zhihu.com/p/111014448 

 重启终端 或者 运行 source /Users/liumiao/.zprofile  ,否则可能无法使用
  
liumiao@liumiaodeMacBook-Pro ~ % 

验证

使用brew 安装wget

liumiao@liumiaodeMacBook-Pro ~ % wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh
zsh: command not found: wget
liumiao@liumiaodeMacBook-Pro ~ % cat /Users/liumiao/.zprofile

  export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles #ckbrew
  eval $(/usr/local/Homebrew/bin/brew shellenv) #ckbrew

liumiao@liumiaodeMacBook-Pro ~ % brew install wget
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gettext-0.21.big_sur.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libunistring-0.9.10.big_sur.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libidn2-2.3.0.big_sur.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1j.big_sur.bottle.1.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/wget-1.21.1.big_sur.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for wget: gettext, libunistring, libidn2 and openssl@1.1
==> Installing wget dependency: gettext
==> Pouring gettext-0.21.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/gettext/0.21: 1,953 files, 19.8MB
==> Installing wget dependency: libunistring
==> Pouring libunistring-0.9.10.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/libunistring/0.9.10: 55 files, 4.5MB
==> Installing wget dependency: libidn2
==> Pouring libidn2-2.3.0.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/libidn2/2.3.0: 72 files, 808.2KB
==> Installing wget dependency: openssl@1.1
==> Pouring openssl@1.1-1.1.1j.big_sur.bottle.1.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1j: 8,071 files, 18.5MB
==> Installing wget
==> Pouring wget-1.21.1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/wget/1.21.1: 88 files, 4MB
==> Caveats
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

liumiao@liumiaodeMacBook-Pro ~ % which wget
/usr/local/bin/wget
liumiao@liumiaodeMacBook-Pro ~ % 

淼叔 CSDN认证博客专家 神经网络 TensorFlow NLP
资深架构师,PMP、OCP、CSM、HPE University讲师,EXIN DevOps Professional与DevOps Master认证讲师,曾担任HPE GD China DevOps & Agile Leader,帮助企业级客户提供DevOps咨询培训以及实施指导。熟悉通信和金融领域,有超过十年金融外汇行业的架构设计、开发、维护经验,在十几年的IT从业生涯中拥有了软件开发设计领域接近全生命周期的经验和知识积累,著有企业级DevOps技术与工具实战。
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页