MacOS – How to install a Homebrew recipe maintained in a separate git repository outside of /usr/local/Library/Formula

githomebrewmacos

I'm writing a quick Homebrew formula for my own private purposes (it's unlikely to be shared). I'd like to install it , but would prefer not to maintain my own local fork of Homebrew, but instead outside /usr/local/Library/Formula (it happens to be within an existing private git repository I have, but I think that's incidental to the question).

I've tried:

  • brew install ./my-formula.rb
  • brew install file:///Users/myusername/mygitrepository/my-formula.rb.

Neither seems to work. Instead I see:

Error: No available formula for my-formula
==> Searching formulae...
==> Searching taps...

How can I install this formula?

Note: Installing the formula using git repository syntax is unlikely to be what I need – I'm looking to install the formula during its development, in other words before I commit to my git repo.

I am using Homebrew 0.9.5.

Best Answer

ln -s /Users/myusername/mygitrepository/my-formula.rb /usr/local/Library/Formula/
brew install my-formula

Both brew doctor and brew update shouldn't mind, at least not until a my-formula formula is added into the official brew repository!