1、安装brew
在mac终端执行命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
报错:
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443
国外服务器搞不了,只能使用国内镜像:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
然后让你选择镜像,我选择【5】阿里镜像,回车, 就安装好了,
执行 brew --help; 或 brew - v; 查看是否安装成功:
kevin.li@kevindeMacBook-Pro ~ % source /Users/kevin.li/.zprofile
kevin.li@kevindeMacBook-Pro ~ % brew -v
Homebrew 3.3.12-19-g51da118
Homebrew/homebrew-core (git revision 13029e26609; last commit 2022-01-26)
Homebrew/homebrew-cask (git revision 51da118a9; last commit 2022-01-25)
Last login: Thu Jan 27 15:17:16 on ttys000
kevin.li@kevindeMacBook-Pro ~ % /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443
kevin.li@kevindeMacBook-Pro ~ % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
开始执行Brew自动安装程序
[cunkai.wang@foxmail.com]
['2022-01-27 16:23:10']['12.1']
https://zhuanlan.zhihu.com/p/111014448
请选择一个下载镜像,例如中科大,输入1回车。
源有时候不稳定,如果git克隆报错重新运行脚本选择源。cask非必须,有部分人需要。
1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源 4、腾讯下载源(不推荐) 5、阿里巴巴下载源(不推荐 缺少cask源)
请输入序号: 5
你选择了阿里巴巴下载源(有可能维护中,无Linux版本)
!!!此脚本将要删除之前的brew(包括它下载的软件),请自行备份。
->是否现在开始执行脚本(N/Y) y
--> 脚本开始执行
Mac os设置开机密码方法:
(设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)
(如果提示This incident will be reported. 在用户与群组中查看是否管理员)
==> 通过命令删除之前的brew、创建一个新的Homebrew文件夹
请输入开机密码,输入过程不显示,输入完后回车
Password:
开始执行
-> 创建文件夹 /opt/homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew
此步骤成功
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /opt/homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kevin.li /opt/homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew
git version 2.32.0 (Apple Git-132)
下载速度觉得慢可以ctrl+c或control+c重新运行脚本选择下载源
==> 克隆Homebrew基本文件
未发现Git代理(属于正常状态)
Cloning into '/opt/homebrew'...
Fetching objects: 201714, done.
此步骤成功
--创建Brew所需要的目录
运行代码 ==> /usr/bin/sudo /bin/chmod u+rwx /opt/homebrew/bin /opt/homebrew/bin/brew
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /opt/homebrew/bin /opt/homebrew/bin/brew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kevin.li /opt/homebrew/bin /opt/homebrew/bin/brew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kevin.li /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R kevin.li:admin /opt/homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /Users/kevin.li/Library/Caches/Homebrew
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /Users/kevin.li/Library/Caches/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R kevin.li /Users/kevin.li/Library/Caches/Homebrew
--依赖目录脚本运行完成
==> 创建brew的替身
==> 克隆Homebrew Core
此处如果显示Password表示需要再次输入开机密码,输入完后回车
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-core'...
Fetching objects: 1132533, done.
Checking connectivity: 1132533, done.
此步骤成功
==> 克隆Homebrew Cask 图形化软件
此处如果显示Password表示需要再次输入开机密码,输入完后回车
阿里源没有Cask 跳过
==> 克隆Homebrew services 管理服务的启停
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 1141, done.
remote: Total 1141 (delta 0), reused 0 (delta 0), pack-reused 1141
Receiving objects: 100% (1141/1141), 331.50 KiB | 262.00 KiB/s, done.
Resolving deltas: 100% (484/484), done.
此步骤成功
==> 配置国内镜像源HOMEBREW BOTTLE
sed: /Users/kevin.li/.zprofile: No such file or directory
环境变量写入->/Users/kevin.li/.zprofile
此步骤成功
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /opt/homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kevin.li /opt/homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew
==> 安装完成,brew版本
Homebrew 3.3.12-19-g51da118-dirty
Homebrew/homebrew-core (git revision 13029e26609; last commit 2022-01-26)
Homebrew/homebrew-cask (git revision 51da118a9; last commit 2022-01-25)
Brew前期配置成功
电脑系统版本:12.1
All user-space services OK, nothing cleaned...
==> brew update-reset
==> Fetching /opt/homebrew...
==> Resetting /opt/homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.
==> Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core...
==> Resetting /opt/homebrew/Library/Taps/homebrew/homebrew-core...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.
==> Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-services...
==> Resetting /opt/homebrew/Library/Taps/homebrew/homebrew-services...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.
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/kevin.li/.zprofile 否则可能无法使用
2、安装telnet
执行命令:
brew install telnet
安装成功后,随便执行一下telnet命令:
telnet 127.0.0.1 80
** 安装成功 但还需要重启终端 或者 运行 source /Users/dengjinshan/.zprofile 否则国内地址无法生效
** sudo chown -R dengjinshan /usr/local/Cellar
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/it_lihongmin/article/details/122719925