又是套娃解决问题的一次经历
macOS版本:10.15.6
1 wget issue
使用wget发现MacBook上没有,并提示
-bash: wget: command not found
- 解决方法
- 先安装Homebrew: Homebrew
- 然后再
brew install wget
即可。
2 安装homebrew issue
进入homebrew主页按照步骤安装,提示connection 有问题
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
为了解决这个报错,我试了几个办法,比如:
- 查询 raw.githubusercontent.com对应的IP 地址,替换host文件。失败啦~
- 执行
sudo gem install redis
,然后再执行/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
。失败啦~ - 使用国内的镜像地址,成功啦!
执行/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
3 brew install issue
再运行brew install wget
发现还是有error,会报
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/gettext-0.21.catalina.bottle.tar.gz
==> Downloading from https://homebrew.bintray.com/gettext-0.21.catalina.bottle.tar.gz
-=O#- # # #
curl: (22) The requested URL returned error: 404 Not Found
Trying a mirror...
==> Downloading https://ghcr.io/v2/homebrew/core/gettext-0.21.catalina.bottle.tar.gz
==> Downloading from https://github.com/-/v2/packages/container/package/homebrew%2Fcore%2Fgettext-0.21.catalina.bottle.tar.gz
#=#=-# #
curl: (22) The requested URL returned error: 404
Error: Failed to download resource "gettext"
Download failed: https://ghcr.io/v2/homebrew/core/gettext-0.21.catalina.bottle.tar.gz
明天继续更新。。。。。。
2021-04-14 Update
运行brew config
,得到一行关键信息:
HOMEBREW_BOTTLE_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles
这个地址是错误的,所以install任何包都会报404 error。
我查阅了Homebrew Bottles 源使用帮助,正确的地址是:
https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/
因此解决办法就是更改环境变量,把HOMEBREW_BOTTLE_DOMAIN改正确就可以啦~Homebrew Bottles 源使用帮助里面的方法也很清晰。
我运行了下面这一行命令:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zshrc
source ~/.zshrc
不放心的话再运行一次brew config
看一眼,此时发现已经改对啦~
HOMEBREW_BOTTLE_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles/bottles
4 安装wget成功🥳
最后运行brew install wget
。得到很可爱的啤酒杯🍺,就可以一起干杯啦🍻。
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libidn2-2.3.0.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1k.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/wget-1.21.1.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for wget: libunistring, libidn2 and openssl@1.1
==> Installing wget dependency: libunistring
==> Pouring libunistring-0.9.10.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/libunistring/0.9.10: 54 files, 4.4MB
==> Installing wget dependency: libidn2
==> Pouring libidn2-2.3.0.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/libidn2/2.3.0: 70 files, 728KB
==> Installing wget dependency: openssl@1.1
....
==> Summary
🍺 /usr/local/Cellar/openssl@1.1/1.1.1k: 8,071 files, 18.5MB
==> Installing wget
==> Pouring wget-1.21.1.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/wget/1.21.1: 88 files, 4MB
==> Caveats
==> openssl@1.1