I'd like to install several versions of Ruby (or really any Homebrew package) without linking any of them. Basically, I'd like to treat any formula as keg-only.
I can't seem to find a way to do this, although it seems trivial. I thought there'd be something like brew install --no-link .
brew install --no-link
Is there a way to do what I want, or some reason why this is a bad idea?
I'd really like to use Homebrew to install Ruby versions, and rbenv to manage them.
(originally posted http://superuser.com/questions/563484/installing-homebrew-packages-without-linking/577709)
brew install ruby; brew unlink ruby will do it. Doesn't seem a particularly bad idea but if you put rbenv before Homebrew in your path that'll achieve the same.
brew install ruby; brew unlink ruby
Right now the doctor warns if not-keg_only-formulae are unlinked.
I know keg_only formulae are specially handled (they are being added to CFLAGS etc.). Is the same done for unlinked "normal" formulae? Until this is not done, we should hold back a brew install --no-link option because it can break other builds. I am not sure about this - would need to check the source.
Besides that, I think a --no-link option might be worth considering. I heard a similar request several times. Though, I don't have a strong opinion on this.
Honestly, if you want to install multiple Rubies, I would just brew install rbenv ruby-build and let Rbenv/Ruby-build take it from there. You may need to manually set some CFLAGS (see the ruby-build wiki), but the end result is pretty easy to work with.
brew install rbenv ruby-build
Agreed, and you may run into other subtle issues in trying to use Homebrew as a Ruby version manager. For example, the install names of the shared libraries will point at HOMEBREW_PREFIX/lib rather than any specific keg, which seems likely to cause trouble.
Much better off using a tool that was designed for this purpose like ruby-build or https://github.com/postmodern/ruby-install.
Seems to be consensus that this is a WONTFIX, sorry.