How to publish your NodeJS application on Homebrew

Learn how to publish NodeJS CLI application on the popular Homebrew package manager using Github

Homebrew is the de-facto package manager when it comes to macOS. It is quite easy to publish your projects on Homebrew without any ruby knowledge.

Preparing the binaries

The first step is to create a standalone executable binary where the NodeJS runtime will be baked inside the binary file. For this, I made use of an awesome tool pkg by Vercel.

npm install pkg -g
pkg package.json
"pkg": {
"targets": [
"outputPath": "release"

Creating Tar File

Homebrew expects a TAR archive, and it’s easy to create one using the commands: In my case

cd release
mv getfilesize-cli-macos getfilesize
tar -czf getfilesize.tar.gz getfilesize
shasum -a 256 getfilesize.tar.gz

Creating GitHub Releases

Homebrew requires a URL to download your binary. There are plenty of ways to host your executable, but for my project, I used GitHub Releases, mainly because it’s free, easy to use, and my project is hosted on it.

Preparing the GitHub Repository

Homebrew offers a way to create third-party repositories via Taps. In a nutshell, Taps are just GitHub repositories with specific names and a few configuration files.


Creating the Formulae

Please clone the homebrew-getfilesize repository created in the previous step in your local machine. Now you will need to create a Homebrew Formula for your project, a very simple Ruby file containing the instructions to install your binary on the user computers.

- getfilesize.rb
class Getfilesize < Formula
desc "Get Human Readable file size information. - CLI"
homepage ""
url ""
sha256 "6c03100f5b1f8e61f5d49efab759a2efcdbcc4ac2677fcf98e7317ec660e6994"
license "MIT"
version "1.0.1"

def install
bin.install "getfilesize"
def install
bin.install "getfilesize"

Installing the Package

All right, if you are with me till here, your users are ready to install the package using Homebrew:

brew tap bharathvaj-ganesan/getfilesize
brew install getfilesize

Next Steps

This was a very basic way to publish your package on Homebrew, but things can get much better. In fact, we can automate the packaging process via Github Actions. DM me if you would like to discuss more on the setup.


Fullstack JavaScript Developer | Cybernaut | InfoSec Enthusiast |