19

What are the key features of a homebrew recipe?

If I want to contribute a recipe, e.g. this one for udunits to the the hombrew-science repository, how would I convert a command-line script like this:

wget ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.1.24.tar.gz
tar -xvf udunits-2.1.24.tar.gz
cd udunits-2.1.24
./configure 
make 
make check
make clean

into a valid recipe?

  • Brew will extract and cd automatically. You don't need to run make clean, because the build directory is temporary. The current answer has the rest. – daviewales Mar 24 '14 at 13:03
22

This Homebrew README gives these steps (with links to more information):

Contributing

In short:

  1. Fork Homebrew.
  2. brew create http://example.com/foo-0.1.tar.gz
  3. git checkout -b foo
  4. git commit Library/Formula/foo.rb && git push
  5. Pull Request.

In long:

Homebrew formulas are written in Ruby (tested against Ruby 2.0.0). Knowledge of Ruby certainly helps, but you might be able to get a feel for how to do basic procedures like you outline above just by reading a few existing formulae.

Getting a formula accepted also requires a little knowledge of Git and GitHub pull requests, but is covered How to open a Homebrew pull request (and get it merged)

  • 4
    To the 'Homebrew formulas are written in Ruby point' -- I've seen a bunch of formulas now that use Ruby as a caller in to an installation routine written in another language. So at a minimum you need to know enough Ruby to do the install/uninstall routines and the rest you can do in <insert language of your choice here> by calling out to a helper script. – Ian C. Mar 19 '14 at 19:41
  • 1
    That's good to know. – echristopherson Mar 19 '14 at 21:53
  • 5
    The amount of Ruby you need to know to create a recipe is practically nothing, about 0.00001% of the full Ruby language. You're basically setting a few parameters, but the big benefit of it being written in Ruby is that you have all of Ruby available to you to do whatever you need. (People who spread FUD about Homebrew or Vagrant or Puppet etc. using Ruby are either clueless or dishonest, as in all cases you can get by with composing something about as complex as an .INI file, but you are not limited to that.) Bottom line: don't be intimidated. You don't need Ruby experience. – iconoclast May 14 '14 at 21:27
0

Another approach:

Checkout How To Open a Homebrew Pull Request (and get it merged)

P.S. I don't have enough reputation to comment so sorry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .