使用 Homebrew 安装 icu4c 版本 63

Install icu4c version 63 with Homebrew

我正试图开始 psql 但得到了

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

当我使用 postgres -D /usr/local/var/postgres 时,出现以下错误:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
  Referenced from: /usr/local/bin/postgres
  Reason: image not found
[1]    2559 abort      postgres -D /usr/local/var/postgres

libicui18n.63.dylib 上的快速搜索显示我需要 icu4c 63 版的库。但是 brew list icu4c 说我有 64.2 版。

我尝试了 brew install icu4c 63brew install icu4c@63 但没有成功。

有人可以帮忙吗?提前致谢。

解决方案:

  1. cd 到 Homebrew 的公式目录
  • 英特尔
    cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
    
  • M1
    cd $(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula
    
  1. 找到所需的提交(icu4c 的版本 63)以签出
git log --follow icu4c.rb
  1. 签到新分支
git checkout -b icu4c-63 e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7
  1. 使用新版本重新安装库
brew reinstall ./icu4c.rb
  1. 切换到重新安装的版本
brew switch icu4c 63.1
  1. 结帐回主
git checkout master

来源:

最终不止一次使用它的人的奖励:

# zsh
function hiicu63() {
  local last_dir=$(pwd)

  cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
  git checkout icu4c-63
  brew reinstall ./icu4c.rb
  brew switch icu4c 63.1
  git checkout master

  cd $last_dir
}

这应该更容易。

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7/Formula/icu4c.rb

如@dingusjh 所说,但使用 reinstall 命令而不是 install 以防 brew 抱怨已经安装了 icu4c,你应该尝试 extract。完整的命令将是:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7/Formula/icu4c.rb

对我来说,重新安装 icu4c 成功了 brew reinstall icu4c