php: dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
阿新 • • 發佈:2020-09-02
mac上本來安裝了php7.1版本,後來安裝了node,結果再次執行php的時候,出現錯誤
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib Referenced from: /usr/local/opt/php@7.1/bin/php Reason: image not found [1] 86657 abort php -v
,查了一下,發現node升級了icu4c的版本到了67.1,導致php7.1使用的63版本連結庫找不到
解決方法:
網上查詢試了很多方法但是都不行,後來在stackoverflow上找到了解決方法,記錄在此:
22 16 I was trying to start psql but got 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"? When I used postgres -D /usr/local/var/postgres, got the following error: 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 A quick search on libicui18n.63.dylib showed me I need icu4c lib with version 63. However brew list icu4c says I have the version 64.2. I tried both brewinstall icu4c 63 & brew install icu4c@63 but no luck. Can anyone help, please? Thanks in advance. postgresql homebrew icu4c share improve this question follow asked Apr 24 '19 at 9:00 ogirginc 2,84011 gold badge1919 silver badges3030 bronze badges add a comment 3 Answers Active Oldest Votes 97 Solution: 1) cd to Homebrew's formula directory cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula 2) Find desired commit (version 63 for icu4c) to checkout git log --follow icu4c.rb 3) Checkout to a new branch git checkout -b icu4c-63 e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7 4) Reinstall the library with the new version brew reinstall ./icu4c.rb 5) Switch to the reinstalled version brew switch icu4c 63.1 6) Checkout back to master git checkout master Sources: Homebrew install specific version of formula? http://hanxue-it.blogspot.com/2018/08/macos-homebrew-installing-older-version-of-software.html Bonus for those who ended up using this more than once: # 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 }
參考:
https://stackoverflow.com/questions/55826221/install-icu4c-version-63-with-homebrew