Checking for external existance of dependency

Sorry if this has been asked before, but I couldn’t seem to find anything…

I have a particular issue with one formula ( that i’d like to hep improve, as often for other compatibility reasons (nothing to do with Homebrew) it’s better to install mono from their official installer. So then running this formula means I end up with two versions of mono.

Does anyone know if there’s a way with either Homebrew-specific, or Ruby code, to check if a dependency exists externally to a Formula, and if so, not install the Homebrew dependency?

Since the homebrew environment is strictly filtered there is no way to do this in homebrew-core. Users install a lot of shit and anything that depends on user managed dependencies is bound to create more problems then it solves.

If you want to take this risk in a seperate tap you could check and write your own custom requirement. That could be satisfied by your own mono install.

Thanks @SMillerDev I might also look at attempting to contribute to/encourage the other projects that expect Mono to be at a particular path to change that behaviour instead, as really it shouldn’t matter.

That seems reasonable, as a package manager you should always be able to tell projects where it should look for it’s dependencies IMHO.

@ChrisChinchilla I’ve add the mono dependency & docfx to my tap that looks to see if it can fulfill requirements in the user’s environment: brew install gfguthrie/stdenv/docfx

@gfguthrie Ah, nice, do you keep that up to date too? Or, I mean, could you contribute this to the “official” formula?

Homebrew policy regarding external dependencies/looking at the user’s environment means that it can’t be part of core – so instead I make sure to get notified when the formulas in my repo get updated, so that I can then keep them up to date. A gentle nudge or pull request is welcome for anything I may have missed (or for any other formulas anyone wants to get added).