How to tap Homebrew/linuxbrew-core on MacOS

I’m thinking that since linuxbrew-core is a superset of homebrew-core,
then I’d like to tap linuxbrew-core on a mac e.g. /usr/local/Homebrew/Library/Taps/homebrew/linuxbrew-core

but brew tap homebrew/linuxbrew-core https://github.com/homebrew/linuxbrew-core.git doesn’t seem to work.


Q: why in the world do you want that?
A: because I’m bootstrapping my CI pipelines based on linuxbrew and I’d like to have the development machines (running macos) aligned with the changes in linuxbrew-core, rather than homebrew-core. Easier to run brew update, brew cat, brew extract.

I now had a look at the sourcecode, and saw a bunch of replacements linuxbrew -> homebrew, so I reckon that it’s not possible unless I do smth like brew tap smth_not_linuxbrew_nor_homebrew/linuxbrew-core https://github.com/homebrew/linuxbrew-core.git

I’m guessing some code like this in tap.rb could make use of a OS.linux? checks, and then tapping linuxbrew-core on mac would work, because it wouldn’t be the coretap anymore:

    user = user.capitalize if ["homebrew", "linuxbrew"].include? user
    repo = repo.sub(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX, "")

    return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)

It looks like in some places, there is a OS.linux? check, for instance after

brew tap linux/linuxbrew-core https://github.com/homebrew/linuxbrew-core.git

one cannot do brew cat linux/core/perl because it looks for the formula in /usr/local/Homebrew/Library/Taps/linux/homebrew-core/Formula/perl.rb

so FWIW a temporary working workaround is

brew tap linux/homebrew-core https://github.com/homebrew/linuxbrew-core.git

I’m thinking that since linuxbrew-core is a superset of homebrew-core,

While it’s a superset, the changes aren’t tested on macOS so this will break a lot of stuff. The better solution would be to help migrate the formulae you need from linuxbrew to homebrew proper.

1 Like

the changes aren’t tested on macOS so this will break a lot of stuff.

I know the changes are tested on macOS, but afaics the relatively-few (in the tens) formulas I need are carefully crafted to do stuff ONLY on linux (actually on “unless OS.mac?”). Extrapolating this, I don’t see “lots of stuff” breaking unless you have empirical results already. I can surely try installing all of my formulas on MacOS via linuxbrew, and collect a few datapoints to see what breaks, if something breaks.

Try…

cd $(brew --repo homebrew/core)
git remote set-url origin https://github.com/Homebrew/linuxbrew-core

Linuxbrew-core is not supported on macOS, so please do not open issues to report bugs that result from testing this configuration. We will review PRs if you wish to fix issues that arise.