惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

SangSir丨艺术界的一朵奇葩丨至一网络科技

Windows 使用 Hyper-V 网络上传速度异常慢解决方案 Uniapp h5部署到服务器刷新页面出现404 Uniapp中plus.contacts.getAddressBook获取通讯录为返回type:0解决方案 天地图修改主题颜色修改背景色 宝塔服务器多站点配置多个redis节点以及自启动方案 Part.Three. 前端JOB MODEL Part Two. 前端面试题库 Part One. 前端react方向 阿里巴巴前端暑期实习面经
Mac homebrew 升级导致的 php 不能正常启动 dyld[40013]: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicuio
博主: SangSir · 2023-09-11 · via SangSir丨艺术界的一朵奇葩丨至一网络科技

Mac homebrew 安装 php 7.4 版本时出现报错,原因是php新版本都在用 icu4c 73 版本,没有相关文件所以安装失败,这里找了个解决方案,可以安装更新版本,并与老版本共存。

知乎-brew 怎么安装特定版本的软件?

以下为文章备份:

自定义brew 安装源来安装不在brew 版本库中的软件或者版本,以下以自定义安装icu4c 73版本为例。

自定义的 icu4c@73.rb 安装源示例, 注意这里可能会安装多个版本的软件,所以.rb文件的命名为要安装的软件名+大版本名,类名为 Icu4cAT73

icu4c@73.rb 文件示例

# 自定义brew Formula for Icu4c 自定义版本
# 使用方法:
# 1. 直接指定rb文件安装: brew install icu4c@73.rb
# 2. 将icu4c@73.rb文件放到brew的默认Formula路径 然后执行 brew install icu4c@73
# 路径:/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/icu4c@73.rb
# 
# 注意下面的class名称,Icu4c 驼峰命名的要安装的软件名称 Icu4c,
# 后面的 AT 即 @ (@转换为slug命名即 AT)加大版本号 73 注意不能有特殊符号
class Icu4cAT73 < Formula
  # 软件描述信息
  desc "C/C++ and Java libraries for Unicode and globalization"
  # 软件提供商URL
  homepage "https://site.icu-project.org/home"
  # 软件包的下载地址
  url "https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz"
  # 镜像地址
  mirror "http://192.168.2.88/icu4c-73_2-src.tgz"
  # 版本号
  version "73.2"
  # 软件镜像包的 sha256签名信息,下载到本地可使用 openssl sha256 icu4c-73_2-src.tgz 命令来计算
  sha256 "818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1"
  # 版权
  license "GPL"

  # 新版本检测
  livecheck do
    # 要检测的URL地址
    url "https://github.com/unicode-org/icu/releases"
    # 正则提取版本信息
    regex(/href=.*?release-([0-9._-]+)"/i)
  end

  keg_only :provided_by_macos, "macOS provides libicucore.dylib (but nothing else)"

  # 安装方法
  def install
    # 定义./configure 配置参数
    args = %W[
      --prefix=#{prefix}
      --disable-samples
      --disable-tests
      --enable-static
      --with-library-bits=64
    ]
    # 注意默认路径是压缩包解压后的根目录,因为 进入到source目录
    cd "source" do
      system "./configure", *args
      system "make"
      system "make", "install"
    end
  end

  # 测试方法定义,这里可以定义多个测试项目
  test do
    if File.exist? "/usr/share/dict/words"
      system "#{bin}/gendict", "--uchars", "/usr/share/dict/words", "dict"
    else
      (testpath/"hello").write "hello\nworld\n"
      system "#{bin}/gendict", "--uchars", "hello", "dict"
    end
  end
end
# 安装自定义的formula
brew install  icu4c@73

# 检查安装信息 
brew info icu4c@73

安装后默认会将软件的安装目录 /usr/local/Cellar/icu4c@73/73.2 链接到 /usr/local/opt/icu4c@73

在使用的时候直接使用 /usr/local/opt/icu4c@73 ,这样后面更新相同的大版本brew会自动更新相关的软链接

创建软连接,解决其他软件找不到库的问题

# 创建软链接 解决php5.6不能运行问题
ln -sf /usr/local/opt/icu4c@73/lib/libicui18n.73.2.dylib /usr/local/lib/libicui18n.73.dylib
ln -sf /usr/local/opt/icu4c@73/lib/libicuuc.73.2.dylib /usr/local/lib/libicuuc.73.dylib
ln -sf /usr/local/opt/icu4c@73/lib/libicudata.73.2.dylib /usr/local/lib/libicudata.73.dylib
ln -sf /usr/local/opt/icu4c@73/lib/libicuio.73.2.dylib /usr/local/lib/libicuio.73.dylib

如果不需要了,执行 brew uninstall icu4c@73

或者 直接删除相关文件即可 目录 /usr/local/Cellar/icu4c@73/73.2 软连接 /usr/local/opt/icu4c@73

rm -rf /usr/local/Cellar/icu4c@73/73.2
rm -rf  /usr/local/opt/icu4c@73

#删除相关软链接
rm -f /usr/local/lib/libicui18n.73.dylib
rm -f /usr/local/lib/libicuuc.73.dylib
rm -f /usr/local/lib/libicudata.73.dylib
rm -f /usr/local/lib/libicuio.73.dylib