Using Homebrew for distributing Go (golang) apps
For personal reference:
a) Create your own homebrew tap
Create a new GitHub public repository with a prefix homebrew-
, i.e. homebrew-tap
. This will house all the apps that you want to distribute via your tap. Users will install your apps using the following commands:
The toolname
part will correspond to the filename inside your repository tap. If your repository has an entry with a filename of toolx.rb
, it can be installed using the following commands:
Here’s an example of a formula for a golang app:
You can check out https://github.com/flowerinthenight/homebrew-tap for reference.
The url
part is the path of the source tar.gz
of your source files. You can create this by using tagged releases in GitHub.
You can generate the sha256
part by running the shasum
(OSX) or sha256sum
(Linux) tool against your tar.gz
file.
b) Updating your formula
If you have a new version of your tool, first, create a new tag or release. Download the new tar.gz
file of the new release, run the sha256sum/shasum
tool against it, and update the .rb
file in your tap repository.
Example:
Finally, update the url
and sha256
part of your .rb
file. Users will now be able to update their copies:
If you have any questions or feedback, please reach out @flowerinthenyt.