RBENV managed Rubies: VIM upgrade forcing homebrew to install Ruby

Solution 1:

Ruby is a dependency for building vim with Homebrew according to the package details:

ianc.local
> brew info vim
vim: stable 8.0.0019 (bottled), HEAD
Vi "workalike" with many additional features
http://www.vim.org/
Conflicts with: ex-vi
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vim.rb
==> Dependencies
Optional: lua ✘, luajit ✘
==> Requirements
Required: ruby >= 1.8 ✔, perl >= 5.3 ✔
Recommended: python ✔
Optional: python3 ✔
==> Options
--with-client-server
    Enable client/server mode
--with-custom-perl
    Build with a custom Perl instead of the Homebrew version.
--with-custom-python
    Build with a custom Python 2 instead of the Homebrew version.
--with-custom-ruby
    Build with a custom Ruby instead of the Homebrew version.
--with-lua
    Build vim with lua support
--with-luajit
    Build with luajit support
--with-mzscheme
    Build vim with mzscheme support
--with-override-system-vi
    Override system vi
--with-python3
    Build vim with python3 instead of python[2] support
--with-tcl
    Build vim with tcl support
--without-nls
    Build vim without National Language Support (translated messages, keymaps)
--without-perl
    Build vim without perl support
--without-python
    Build vim without python support
--without-ruby
    Build vim without ruby support
--HEAD
    Install HEAD version

But as you can see, it only requires ruby 1.8. It's installing a ruby because rbenv likely isn't returning an installed ruby when the ruby shim is called by the build package.

Given vim will dynamically link to your Ruby installation, I highly recommend you just switch to system ruby before you brew install or upgrade vim. Something like:

brew uninstall vim ruby
brew cleanup
rbenv global system
brew install --build-from-source vim --with-custom-ruby

The installer will happily use system ruby on the Mac, which has a high enough version, during installation and the resulting binaries created won't segfault if you happen to remove the specific ruby version they were built against, which is a real problem if you use a rbenv-controlled ruby at build time.

Alternatively you can build without ruby support:

brew install vim --without-ruby

But that's probably not what you want.