Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim ruby mismatch on Mac High Sierra

I recently upgraded my Mac to High Sierra

After the upgrade, Macvim (mvim) stopped working because (I assume) HighSierra upgraded ruby to 2.3, and mvim is using ruby 2.0.

Following is the error I am getting

dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib

Referenced from: /usr/local/Cellar/macvim/8.0-134/MacVim.app/Contents/bin/../MacOS/Vim

Do I need to compile vim again or is there any way to fix this problem?

Thanks in advance.

like image 831
user2960993 Avatar asked Nov 14 '17 05:11

user2960993


5 Answers

This worked for me. YMMV brew uninstall --purge macvim brew install macvim

[amended] Regarding the upgrade alone option, that may work if you don't have the current version already. The --purge forces a removal and complete reinstall. Also, the build from source option, while it may work, you now own your own mac-vim static snapshot and need to maintain it manually as the app evolves. I'd avoid building from source unless you have very specific needs.

like image 112
Bruce Edge Avatar answered Nov 10 '22 03:11

Bruce Edge


First find where is the right libruby path, mine is: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib

It is common that the version has changed.

Find out where the absolute path of vim is:

$ which vim
vim: aliased to your-path-of-vim

change dyld:

sudo install_name_tool -change /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib your-path-of-vim
like image 14
John Zhang Avatar answered Nov 10 '22 03:11

John Zhang


➜  ~ vim
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
  Referenced from: /usr/local/bin/vim
  Reason: image not found

I tried brew uninstall install update... All failed. And install_name_tool works for me.

install_name_tool -change /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib /usr/local/bin/vim
like image 12
Hellen Avatar answered Nov 10 '22 02:11

Hellen


This worked for me:

$ brew update

$ brew upgrade macvim

actual command output:

[bin]$ brew upgrade macvim
==> Upgrading 1 outdated package, with result:
macvim 8.0-142
==> Upgrading macvim --with-override-system-vim
==> Downloading https://github.com/macvim-dev/macvim/archive/snapshot-142.tar.gz
==> Downloading from https://codeload.github.com/macvim-dev/macvim/tar.gz/snapshot-142
######################################################################## 100,0%
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --enable-ter
==> make
🍺  /usr/local/Cellar/macvim/8.0-142: 2,147 files, 34.2MB, built in 3 minutes 15 seconds
[bin]$ 
like image 7
Guido Avatar answered Nov 10 '22 02:11

Guido


What helped in my case was:

brew link --overwrite vim

In your case, it might be useful to use the same command for MacVim

brew link --overwrite macvim
like image 3
Adrian Grzywaczewski Avatar answered Nov 10 '22 03:11

Adrian Grzywaczewski