MAC brew下载报错

编译 wget 报错

1
2
3
4
5
6
7
8
9
10
11
12
configure: error: in `/Users/macbook/Software/wget-1.21.2':
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details

尝试下载相关依赖,和使用–with=openssl 都没有解决

解决方案

1
# 更换 brew 源,将 brew 默认的 github 源更换为阿里源解决:

使用 阿里云 的 Homebrew 镜像源进行加速

执行 brew 命令安装应用的时候,跟以下 3 个仓库地址有关:

更换 brew.git
1
2
3
cd "$(brew --repo)"

git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
更换 homebrew-core.git
1
2
3
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
更换 homebrew-bottles

这与当前 macOS 系统使用的 shell 版本有关系,执行以下命令查看 Shell版本:

1
2
echo $SHELL
# 根据版本不同,会输出2种结果,/bin/zsh 或 /bin/bash,根据类型进行操作即可
1
2
3
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc

source ~/.zshrc
1
2
3
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

再次下载 wget

1
2
3
brew install wget 

# yeah~ sccuess