Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 <formula>.

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.

share|improve this question
    
Yes, this would be really handy, I couldn't find an answer anywhere either. –  Aron Ahmadia Dec 18 '13 at 2:00
    
I think the lack of this feature is symptomatic of Homebrew's general poor support for versions. You always get the latest, and the only way to get an older version is to hope someone has copied it into the versions keg, or go hunting around the git history. There are far too many things that should be simple command-line arguments but are only doable with brew edit. –  Mark Reed Sep 17 at 10:52

4 Answers 4

All you have to do is to edit the default formula and customize it for your purpose, which is being keg-only. It is actually very easy to make your own customized version of formulas and once you edit a formula Homebrew keeps your personalized version for future uses.

So, just edit the formula file (for the specific tap version you intend to install) and add keg-only "My reason for making this keg-only" within the formula class.

In case you haven't edited a formula before, read these few lines from Homebrew's FAQ in order to learn how to do so.

share|improve this answer

You can run brew install <formula> and then brew unlink <formula>, which removes all the links.

share|improve this answer
    
Right, but that still links Ruby, which will fail if there's a version already linked. I want to install without ever linking. –  also Apr 5 '13 at 20:06

I'm not sure about Ruby, but to do this for many pieces of software, you may want to just download source and adjust the make file, or use the flags for the autoconf configure script to specify the install directory you want, and then you can run it from there.

(From configure --help output)
Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]
share|improve this answer

From man brew:

   ln, link [--overwrite] [--dry-run] formula
          Symlink all of formula's installed files into the Homebrew prefix. 
          This is done automatically when you install formula, but  can
          be useful for DIY installations.

          If --overwrite is passed, Homebrew will delete files which already exist in the prefix while linking.

          If  --dry-run or -n is passed, Homebrew will list all files 
          which would be linked or which would be deleted by brew link 
          --over-write, but will not actually link or delete any files.

I think that --dry-run or -n is what you are looking for.

share|improve this answer
    
No, you can only link a formula after it's been installed. Installing a formula links it's files which is what I want to skip. Brew install doesn't support --dry-run. –  also Mar 13 '13 at 20:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.