目录

系统升级后MAC的brew update出现报错,问题解决了做下记录。

问题1

执行brew update时出现

 homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

先将brew镜像换成中科院的

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

// 把homebrew-core的镜像地址也设为中科院的国内镜像

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

// 更新
brew update

然后按照报错执行

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

问题2

出现报错

fatal: --unshallow on a complete repository does not make sense

此时 执行:

git fetch --depth=10000  

参考:https://stackoverflow.com/questions/28001878/git-fetch-unshallow-gives-fatal-unshallow-on-a-complete-repository-does-n

再执行brew update

问题3

fatal: unable to access 'https://github.com/Homebrew/homebrew-services/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 

执行

curl https://github.com -v

显示

*   Trying 52.74.223.119...
* TCP_NODELAY set
* Connected to github.com (52.74.223.119) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 
* Closing connection 0
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 

Google一下查到:https://github.com/libressl-portable/portable/issues/369
有人提到:I update with brew, libressl, openssl and curl and reboot my machine. It's now working.

执行

brew install libressl 

再执行brew update 搞定。

问题4

其它报错及方法整理:

brew doctor

出现:
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run brew link on these:
python@3.9
可以执行

brew link --help
brew link --overwrite python@3.9
brew doctor

报警解决。参考来源:https://stackoverflow.com/questions/30976312/unlinked-kegs-in-your-cellar-how-do-i-remove-them

问题5

error: OpenSSL crypto library required

MAC先安装openssl

brew install openssl

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/

ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

安装完成后执行

openssl version -a

error: OpenSSL crypto library required

仍然报错搜索到如下内容

Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

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

For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

根据场景执行不同命令,我的情况是compilers,执行的是第二段,问题解决,此问题参考:https://gist.github.com/aklap/e885721ef15c8668ed0a1dd64d2ea1a7

后记

备注:能用Google搜索尽量还是用Google,Baidu真的是什么也搜不出来。如果没法上Google,请到:MAC好用的梯子

©著作权归作者所有

发表评论