Macos – brew upgrade broke Vim on OS X (dyld: Library not loaded)


I've not run brew update && brew upgrade for a long time.

I just did a massive upgrade which turned out to broke my Vim.

This is what I got after running vim:

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

I've came across some websites but none of them were actually helpful.

They said that it might be related to rvm but brew uninstall vim; rvm system; brew install vim didn't help. I tried to reinstall my MacVim as well but it didn't solve the problem.

Adding export PATH="/usr/local/bin:$PATH" to my .bash_profile didn't help either.

Here's the list for future reference:

What happened to my Vim? How can I fix it?

Best Answer


Try to reinstall ruby and vim, e.g.

brew reinstall ruby vim


Here are other suggestions if above won't help:

  • Find any references to DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or DYLD_FRAMEWORK_PATH environmental variables and remove them from the startup shell scripts (e.g. ~/.bashrc, ~/.bash_profile, etc.).