我正在 macOS 上进行实验并尝试过
但这一次我遇到了问题。
*dyld[78742]: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib
Referenced from: <0F8BEC0C-41F5-3781-B77A-20C013908EA6> /opt/homebrew/Cellar/postgresql@11/11.22_1/bin/postgres
Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib' (no such file),
'/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib' (no such file),
'/opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib' (no such file),
'/usr/local/lib/libicui18n.73.dylib' (no such file),
'/usr/lib/libicui18n.73.dylib' (no such file, not in dyld cache),
'/opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib' (no such file),
'/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib' (no such file),
'/opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib' (no such file),
'/usr/local/lib/libicui18n.73.dylib' (no such file),
'/usr/lib/libicui18n.73.dylib' (no such file, not in dyld cache)
no data was returned by command ""/opt/homebrew/Cellar/postgresql@11/11.22_1/bin/postgres" -V"
The program "postgres" is needed by initdb but was not found in the same directory as "/opt/homebrew/Cellar/postgresql@11/11.22_1/bin/initdb".
Check your installation.
我可以将 postgresql@11 作为服务启动,但是当我运行 psql 时,我得到这个:
psql: could not connect to server: Connection refused
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
我尝试过
brew link --overwrite postgresql@11
但我仍然遇到同样的问题。
更新一堆应用程序后重新启动计算机后,我也遇到了这个问题。通过检查
/usr/local/var/log/[email protected]
,我可以看到 postgresql@11
正在寻找 73 版本的 icu4c
。在错误消息中,您可以看到类似 /opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib
的行,它正在 74.2 文件夹下查找版本 73 文件。要查看您当前拥有哪个版本的 icu4c
,请运行:
brew info icu4c
升级到
postgresql@14
可能会将您的版本更新到74。这篇文章中提出的解决方案能够解决我的问题。特别针对最新的73:
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/9ca237a7bc85e854c8465c9ad08f8a333ba27a44/Formula/i/icu4c.rb
brew install icu4c
然后重新启动
postgresql@11
brew services restart postgresql@11
要获取不同版本的
icu4c
,请在历史记录 homebrew-core repo 中搜索您需要的版本,然后选择 Raw 按钮来获取 URL。
此外,如果第一次运行 wget 时出现 Library not returned 错误,请尝试重新安装:
brew reinstall wget