essay | tech | year-summary | about
日期:2022-05-17T00:00:00Z
after you upgrade your ruby to v3.1 via brew,
you will find that you cannot use vim.
$ vi
dyld[82297]: Library not loaded: /opt/homebrew/opt/ruby/lib/libruby.3.0.dylib
Referenced from: /opt/homebrew/Cellar/vim/8.2.3500/bin/vim
Reason: tried: '/opt/homebrew/opt/ruby/lib/libruby.3.0.dylib' (no such file), '/usr/local/lib/libruby.3.0.dylib' (no such file), '/usr/lib/libruby.3.0.dylib' (no such file), '/opt/homebrew/Cellar/ruby/3.1.2/lib/libruby.3.0.dylib' (no such file), '/usr/local/lib/libruby.3.0.dylib' (no such file), '/usr/lib/libruby.3.0.dylib' (no such file)
[1] 82297 abort vi
then you search stack overflow and many sites, they cannot give you an answer.
eg. https://superuser.com/questions/1096438/brew-upgrade-broke-vim-on-os-x-dyld-library-not-loaded
they will tell you reinstall vim and ruby or link ruby etc.
no, they do not work.
here are the answer.
$ ln -s /opt/homebrew/opt/ruby/lib/libruby.3.1.dylib /opt/homebrew/opt/ruby/lib/libruby.3.0.dylib
$ ls -al /opt/homebrew/opt/ruby/lib
total 6032
drwxr-xr-x 7 candy staff 224 May 17 09:10 .
drwxr-xr-x 14 candy staff 448 May 17 07:33 ..
lrwxr-xr-x 1 candy staff 44 May 17 09:10 libruby.3.0.dylib -> /opt/homebrew/opt/ruby/lib/libruby.3.1.dylib
-rw-r--r-- 1 candy staff 3086448 May 17 07:33 libruby.3.1.dylib
lrwxr-xr-x 1 candy staff 17 Apr 12 19:11 libruby.dylib -> libruby.3.1.dylib
drwxr-xr-x 3 candy staff 96 May 17 07:33 pkgconfig
drwxr-xr-x 4 candy staff 128 Apr 12 19:11 ruby