Packaging homebrew formula

These notes are from the experience of building the project -> future-commit

High level steps:

  1. Make executable
  2. Create formula
  3. Serve through a tap

Watch the video

YouTube logo

Make executable

My project was written in node. I could have gone with npm install as well.
But that would require node to be installed on user machine.

As future-commit can be used by a non-npm user as well, therefore I decided to make it fully executable on its own using Vercel's pkg

You can refer to package.json for configuration for pkg

Commands to produce a final artifact:

 npm run build
 npm run package
 tar -cvzf ./dist/future-commit.tar.gz ./dist/future-commit
 sha256sum future-commit.tar.gz

Upload the artifact as a release to Github repository and use its link to create formula in the next step.

Create formula


brew create <url-of-tar.gz-artifac>

In my case it was,

brew create

Once you hit enter, you will be presented with an editor to edit the forumula(.rb, a ruby file).

Editted that as follows:

class FutureCommit < Formula
  desc "Use future date while making git commits"
  homepage ""
  url ""
  sha256 "eb3abe8b972310fd523c3d09ae1b8e5adfeeaf961023afffd3cb5598956a47f4"
  license "MIT"

  def install
    bin.install "future-commit"

  test do
    system "#{bin}/future-commit"
homepage _ _ _ _ your website or github repo url'
url _ _ _ _ from github released artifact
sha256 _ _ _ _ calculated in the build step
license _ _ _ _ you need to decide

Test it locally

After saving the formula, tested it as:

brew install --build-from-source future-commit

Also do auditing:

brew audit --strict /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/future-commit.rb

Serve the tap! 🍻

Created a new repository, cloned it and moved the formula to it.

git clone [email protected]:raevilman/homebrew-tap.git
cp /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/future-commit.rb ./homebrew-tap

taesting the tap

brew tap raevilman/tap
brew tap-info raevilman/tap
brew install future-commit

Points to note

In node script


Permission denied:

Solution -> Make sure your script starts with #!/usr/bin/env bash

Debugging -> Try to debug your formula like:

brew install --build-from-source --verbose --debug future-commit

You should see following line

==> Fixing /home/linuxbrew/.linuxbrew/Cellar/future-commit/0.1.0/bin/future-commit permissions from 755 to 444

Which is because your file didn't start with she-bang. Refer this ->



If you think this is helpful 🎈
Don't keep it to yourself 🙊

Share it with your lovely followers at twitter 🗽

lets connect viatwitter