On running sudo vim
I'm getting the following error-
dyld: Library not loaded: /usr/local/opt/ruby/lib/libruby.2.3.0.dylib
Referenced from: /usr/local/bin/vim
Reason: image not found
Trace/BPT trap: 5
running below commands as root
user-
which -a vim
returns the following-
/usr/local/bin/vim
/usr/bin/vim
I also have MacVim installed.
which -a ruby
returns-
/usr/local/bin/ruby
/usr/bin/ruby
ruby -v
returns-
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
I don't want to create alias for vim in the root. I'm looking to fix the existing installation in /usr/local/bin/vim
FYI this was already asked here, but that solution didn't work for me, so just in case, here's how I fixed it:
/usr/bin/vim
is your system vim, but you've chosen to override it with /usr/local/bin/vim
(probably from homebrew, right?). I'm willing to bet that running system vim will actually work and not throw up that error, but obviously you want to use the other version.
I think it's just some issue with brew's vim linking to the wrong local version of ruby or some other black magic, so the easiest fix (for me at least), was literally just restarting from scratch! brew uninstall vim && brew install vim
if you used Homebrew, or the equivalent if you did something else.
Note: obviously if you require a specific build of vim you'll need to include the version number.