How to create a tap that works on Linux and macOS

(Carlos Alexandro Becker) #1


I have several go apps that have taps that look like this one:

My question is: now that brew supports linux too, how can I make a tap that works on both linux and mac? I couldn’t find anything on the docs - maybe I just looked in the wrong place.


(Sean Molenaar) #2

There’s nothing stopping a formula from being used on either platform unless you add a specific requirement to a platform. Unless you do something like depends_on => :macos_sierra it’d be run fine on both platforms afaik.

(Carlos Alexandro Becker) #3

hmm, got it, so, if I have different URLs for each platform, what should I do?

(Carlos Alexandro Becker) #4

I tried to do this:

but when I try to install it on Linuxbrew I get this error:

==> Installing antibody-test from getantibody/tap
Error: The following formula
cannot be installed as binary package and must be built from source.

(Carlos Alexandro Becker) #5

Oh… I was testing on docker, and I didn’t had GCC installed, that’s why!

Installed GCC and it worked.


(Shaun Jackman) #6

You can use the linuxbrew/brew Docker image!

( 0x639d1dec74) #7

@caarlos0 This is still opened

It contains this response:
@chiefy all is supported:
brew tap getantibody/homebrew-tap && brew install antibody-test # OR brew install antibody

==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/antibody-test/4.1.0: 5 files, 4.1MB, built in 9 seconds
~$ antibody -v
antibody version 4.1.0

(Carlos Alexandro Becker) #8

oops, I didn’t see that issue, thanks for pointing it out!

(Sean Goller) #9

I’m using a tap that is downloading binaries directly from GitHub, and there are separate ones for Linux and Mac OS. Is there a way to tag or differentiate urls by OS in the formula?

(Shaun Jackman) #10

Yes. See for example tbl2asn in the tap Brewsci/bio.

( 0x639d1dec74) #11

Where are rubocop files in YAML format what give track to follow when GoReleaser generates stuff like homebrew formulae. Where isn’t anything comparing in Go. But I think read these files is good practice (you could do some little CI with ruby-bundler-rubocop to check generated formulae).

( 0x639d1dec74) #12

Here they are,
Rubocop YAML files are in $(brew --prefix)/Homebrew/Library…
In these files look at *More info at URL lines - for tips how to write formulae/casks.
Beyong presented only brew’s repo baked ruby files that extend Rubocop to do formulae/cask checking:

So draw your own conclusions…