很久没有写php了,像往常一样先升个级。
brew install php@8.2
安装后打算修改~/.zshrc
让命令行使用8.2版本,发现无法运行vim,提示如下报错信息:
➜ ~ vim
dyld[28879]: Library not loaded: /opt/homebrew/opt/libsodium/lib/libsodium.23.dylib
Referenced from: <BA441469-20D2-3A07-ABCE-790A3BE0C6E1> /opt/homebrew/Cellar/vim/9.0.1650/bin/vim
Reason: tried: '/opt/homebrew/opt/libsodium/lib/libsodium.23.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libsodium/lib/libsodium.23.dylib' (no such file), '/opt/homebrew/opt/libsodium/lib/libsodium.23.dylib' (no such file), '/usr/local/lib/libsodium.23.dylib' (no such file), '/usr/lib/libsodium.23.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/libsodium/1.0.19/lib/libsodium.23.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/libsodium/1.0.19/lib/libsodium.23.dylib' (no such file), '/opt/homebrew/Cellar/libsodium/1.0.19/lib/libsodium.23.dylib' (no such file), '/usr/local/lib/libsodium.23.dylib' (no such file), '/usr/lib/libsodium.23.dylib' (no such file, not in dyld cache)
[1] 28879 abort vim
这是因为 homebrew 的软链有问题,重新进行软链搞定:
ln -s /opt/homebrew/Cellar/libsodium/1.0.19/lib/libsodium.26.dylib /opt/homebrew/opt/libsodium/lib/libsodium.23.dylib
接着运行vim会遇到新的报错:
➜ lib (stable) ✔ vim
dyld[35527]: Library not loaded: /opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE/libperl.dylib
Referenced from: <BA441469-20D2-3A07-ABCE-790A3BE0C6E1> /opt/homebrew/Cellar/vim/9.0.1650/bin/vim
Reason: tried: '/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE/libperl.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE/libperl.dylib' (no such file), '/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE/libperl.dylib' (no such file), '/usr/local/lib/libperl.dylib' (no such file), '/usr/lib/libperl.dylib' (no such file, not in dyld cache)
[1] 35527 abort vim
显然是vim使用了错误的perl版本导致的问题,这是因为在brew upgrade
的过程中,perl进行了升级,而vim仍在使用指定的perl版本,这里vim官方issue中有讨论到。通过查阅issue的讨论内容,找到一个最有效的做法就是重装vim,问题解决。
brew reinstall vim
Every time
看来锅是苹果的呀……perl
,python
orruby
are upgraded or revision bumped,vim
needs to bebrew reinstall
‘d. It’s a known issue. This would be a known issue even against the system Perl if Apple ever gets round to implementing another major Perl update.