Bob Peaks
Bob Peaks

Reputation: 101

Multiple homebrew installations - not recommended but best solution?

I'm on OSX, 10.8.3, ad use homebrew. I was wondering it would be possible to have multiple instances installed. I have the default /usr/local/ install but would like to have a completely separate version where I can test packages and different installs without screwing up my basic install in /usr/local/ that works great.

I read the wiki and all that about installing into ~/(.)homebrew and then symlinking "brew" to /usr/local/ but I imagine that would conflict with my current install in that directory.

I do not mind, and realize I will have to change my projects to work with the different homebrew path but if anybody has done this and has some suggestions I would greatly appreciate it.

There is still no great way to clean dependencies for formulas well, imo, although progress has definitely been made. I know it's not recommended but I would like to have a "test" homebrew install where I can install all kinds of temporary packages needed for just one or two quick tasks and remove. I appreciate ANY and ALL advice so if you have anything that might be helpful, please do let me know.

Cheers and thank you SO community!

Upvotes: 2

Views: 470

Answers (1)

Andrew Janke
Andrew Janke

Reputation: 23848

I'd recommend using a virtual machine as a testbed, instead of an alternate homebrew installation path. A VM setup has several advantages:

  • Homebrew can still live in its preferred, supported path.
  • You can see exactly what your formula changes will do to a "normal" installation.
  • You can still use broken, non-relocatable formulae safely.
  • Files are guaranteed not to leak out of your alternate path and clobber the main Homebrew install or other stuff, like they can if you have errors in your formulas
  • You can use VM snapshots to provide a clean baseline, and revert to them to discard any changes or mistakes.
  • You can make a bunch of alternate setups instead of just one or two, and they're all independent.
  • You can have a minimal install to isolate variables and reduce interactions.
  • You can even run them with other OS versions.
  • You can mess around with scary low-level stuff like kernel extensions without fear.
  • You can hand off an entire machine to a collaborator so they can se exactly what context your testing stuff in.
  • It's good practice for learning how to automate and modularize machine setup and configuration and will make your code & deployment process better.
  • Etc etc

I use VMs for all my Homebrew development work and it's great. I will never be doing deployment-oriented work without VMs again. Parallels is good, totally worth the money IMHO, or you can pick up VirtualBox for free.

To get your development code between instances, you can use git or other version control to shuffle them around, or mount virtual shared drives, or both.

Upvotes: 1

Related Questions