Creating a Homebrew Formulae

Creating a HomeBrew Formulae

Recently, I created a brew formulae for the Kuma’s CLI. This is my first homebrew formula and I learned so many while doing it. In this, I will tell what is homebrew how to create a homebrew formulae .

What is HomeBrew? Homebrew is the package manager for your mac os machines similar like apt or yum these are the package managers for your Linux operating system.

How to create a Formulae?

To create a formuale , you need a buildable version of your software which can be in the form tar or git and other different types. Then you need to run brew create https://example.com/foo-0.1.tar.gz (Make sure you installed brew in your machine). To specify the build type, we need to pass the – type flag. ( eg: –go ).

This will create a pre-defined template of your formulae. Brew Formulae are nothing but simple ruby files. Clear all the predefined comments, else you will get an error while auditing. After completing your formulae, you need to test it by brew install –build-from-source foo . This will install the formula in your local and which can be found at the location /usr/local/Cellar .

Then you need to write a valid test for your formulae. Brew cookbook suggests that a good test that will address some of the functionality of the software and not basic version check or help command. After this run brew audit –strict foo which will list all the warnings like PRE-DEFINED Comments and WHITE Spaces, Alignments, Version checks, etc. If no errors mean, fork the repo, create a branch and make a pull request :).

This is just a basic blog about how to start with the initial steps for creating a formula, For more reference refer brew formula cookbook. The better thing, I would suggest is to have a look at different formulae’s of other organization or tool which meets your need.

Thanks