使用Homebrew安装icu4c 63版

ogi*_*inc 9 postgresql homebrew icu4c

我试图开始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"?
Run Code Online (Sandbox Code Playgroud)

当我使用时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
Run Code Online (Sandbox Code Playgroud)

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

我都尝试过brew install icu4c 63brew install icu4c@63但没有运气。

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

ogi*_*inc 50

解:

1)cd到自制软件的公式目录

cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
Run Code Online (Sandbox Code Playgroud)

2)查找所需的提交(版本63为icu4c)以结帐

git log --follow icu4c.rb
Run Code Online (Sandbox Code Playgroud)

3)结帐到新分支

git checkout -b icu4c-63 e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7
Run Code Online (Sandbox Code Playgroud)

4)用新版本重新安装库

brew reinstall ./icu4c.rb
Run Code Online (Sandbox Code Playgroud)

5)切换到重新安装的版本

brew switch icu4c 63.1
Run Code Online (Sandbox Code Playgroud)

6)结帐回主人

git checkout master
Run Code Online (Sandbox Code Playgroud)

资料来源:

  • 用绝对绝妙的方式在brew中安装旧版本,比我见过的其他方法容易得多,非常感谢! (2认同)
  • 如果由于某种原因你无法在 git 日志中看到你需要的版本,你可以尝试下载之前的完整历史记录, `git -C "$(brew --repo homebrew/core)" fetch --unshallow ` (2认同)

wlo*_*ske 8

就像@dingusjh所说的一样,但是请使用reinstallcommand install,以免brew抱怨已经安装了icu4c,您应该尝试这样做extract。完整的命令将是:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7/Formula/icu4c.rb
Run Code Online (Sandbox Code Playgroud)