关于homebrew:记录一次brew-回滚-icu4c-操作

44次阅读

共计 1351 个字符,预计需要花费 4 分钟才能阅读完成。

前情提要

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

$php -v
dyld: 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 68
Error: 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.rb
Traceback (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 -v
PHP 7.1.33 (cli) (built: Feb 28 2021 06:44:57) (NTS)
Copyright (c) 1997-2018 The PHP Group
Zend 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 outdated
icu4c (68.2) < 69.1 [pinned at 68.2]

正文完
 0