Install formula with as little dependencies as possible


(Marcel Pociot) #1

Hi,

here’s what I’m trying to do:

I want to build a custom Mac application that contains dependencies installed via homebrew.

Here’s what I’m thinking on how to make this work:

  • clone Homebrew into the future target directory - for example /Applications/SomeApp
  • Install the homebrew dependencies inside of this custom homebrew path
  • Package the /Applications/SomeApp folder that now contains all correctly-prefixed built dependencies

While this works, my problem is that I end up having way too many dependencies.

For example:

The “php” formula has a build-only dependency of “httpd”.
“httpd” has other dependencies, that might not be required for “php” or “nginx”

So my question is: What is the best way to install the dependencies that I need and only keep the ones that I actually need during runtime?

Thanks for any help in advance!


(Mike McQuaid) #2

Homebrew is not supported for building libraries for distribution as it’ll build libraries optimised for the relevant system. I’d instead suggest that your app build whatever tools you need in its own build system.


(Marcel Pociot) #3

Thanks for the reply.

Could you elaborate more on “optimised for the relevant system”?
If I build and package the dependencies for (for example) High Sierra, couldn’t I distribute them as-is for other High Sierra installations?

Isn’t that similar to what existing bottles do?


(Mike McQuaid) #4

Not necessary if they have different CPUs, Xcode versions, etc.