Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew fails when upgrading VIM

When I run brew upgrade on macOS Sierra, the operation fails. The only thing it's trying to upgrade is vim 8.0.0550. I've tried deleting the tar file and forcing a redownload of the upgrade but that hasn't helped. Here is the stacktrace—I can attach more of the log if necessary:

ld: library not found for -lruby.2.4.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [vim] Error 1
make: *** [first] Error 2

Edit: Since posting, a thread on this bug has appeared on github. At time of writing, it's still not 100% clear what the problem is.

like image 800
achalk Avatar asked Apr 09 '17 11:04

achalk


2 Answers

Try this:

  1. Run brew doctor. This showed the following entry in the text: +

    Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run brew link on these:

    ruby

  2. To fix run brew link --overwrite ruby

  3. Now proceed to upgrade vim by running brew upgrade vim

I also recommend to fix other reported unlinked kegs.

Hope this helps. It worked pretty well for me.

like image 171
mljrg Avatar answered Oct 19 '22 10:10

mljrg


I came to this question because I was facing the same problem on my Mac OS Sierra.

I have brew and rvm and the brew vim install was failing with the linker error described in the question above. But, I did not want to switch to rbenv as suggested in the comments. I also was not sure about messing with symlinks as I tend to forget and delete the original files that were being linked :-)

The work around I tried was to temporarily switch to the Mac system Ruby install using the command

rvm use system

Then do the brew upgrade of vim and once the install is complete revert back to the ruby that you want to use with rvm.

This worked for me - YMMV

like image 44
Nikhil Avatar answered Oct 19 '22 12:10

Nikhil