前情提要

我的以后版本Homebrew 3.1.7,零碎环境11.3.1
也是手残,brew upgrade把所有的包都给更新当前,接着一把梭敲了brew cleanup
发现php依赖的icu4c版本对不上了。

$php -vdyld: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicui18n.68.dylib  Referenced from: /opt/homebrew/opt/php@7.1/bin/php  Reason: image not found[1]    54859 abort      php -v

brew switch 生效

$brew switch icu4c 68Error: Unknown command: switch

参考:https://github.com/Homebrew/d...

raw文件装置 生效

关上brew github地址
找到须要装置的68版本raw

$brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/284ffd99cb862671202e685d7eced806bbc30dc4/Formula/icu4c.rbTraceback (most recent call last):    1: from /opt/homebrew/Library/Homebrew/formulary.rb:185:in `klass'/opt/homebrew/Library/Homebrew/formulary.rb:277:in `load_file': Invalid usage: Installation of icu4c from a GitHub commit URL is unsupported! `brew extract icu4c` to a stable tap on GitHub instead. (UsageError)

强制装置

$cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula$rm icu4c.rb $vim icu4c.rb //输出 raw 68.2版本内的内容 保留退出$brew reinstall icu4c…………………………$php -vPHP 7.1.33 (cli) (built: Feb 28 2021 06:44:57) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

锁定版本 免得出错

$brew pin icu4c

回滚强制批改的brew文件

$cd /opt/homebrew/Library/Taps/homebrew/homebrew-core && git stash && git clean -d -f$brew outdatedicu4c (68.2) < 69.1 [pinned at 68.2]