0

My poor old 2008 aluminium MacBook isn't the only old piece of kit I have running homebrew packages, I really appreciate the ability to have a package manager in Mac OS, at least while I make my way to linux. However, even my 2014 iMac is feeling some weight from Homebrew package management. It's slow although very automated, I would like to speed things up a little on my older computers.

Is there any way, that the source code for packages like youtube-dl, aircrack-ng, or most non-bottled packages could be pre-compiled and installed as a binary file for Mac OS / OS X? Or at the very least, something similar to a .deb file (like a bottle), where the source code has been compiled and it's left to the system to appropriately decompress and copy files and libraries to their appropriate locations? Thanks!

1

By default, packages are installed in the way you describe... "Bottles" are precompiled binaries downloaded as compressed tape archives, the contents of which are then "poured" into the appropriate paths.

If you specify options, or use custom compile flags, then naturally brew will build from source. But if you for example, brew install nmap htop bmon, it will download the bottle for your system version and pour it along with any missing dependencies.

That being said, there are definitely situations where brew compiles from source, so to try to answer your question, how often is it that you find this a problem?

There's no way to set it up so that brew compiles on a different machine "automagically" (that is, unless you implement this as a feature and implement it into your installation of brew). You can imagine how this could be difficult; architecture differences aside, conflicts/dependencies needing to be resolved, the differences in environment, etc. would make this a nightmare.

If this is more of an occasional annoyance than a regular problem, what you might want to try is install whatever formula you want on the faster machine with --build-bottle. Then you can "bottle" the package yourself by running brew bottle to install on the slower machine.

I can't recommend this with any level of confidence though, since I don't know how well it would work for all formulae. You would need to be on the same OS/architecture, and the binaries will be compiled for the lowest common denominator CPU (unless you specify which one) so the build might perform worse, depending on which features it was designed to use.

If the difference in compilation time is so large that this seems like a viable route, the two machines might not even be compatible (I don't remember what the 2008 MacBook was, core 2?), and cross-compiling within brew would be a whole separate headache all on its own, you might be better off just not using a package manager at all and compiling/configuring the software yourself.

  • Hi user, I see what you mean by bottling, you're absolutely right that it's already binaries being installed and not compiled. However, if I install something like youtube-dl for example, or anything else from GitHub, it's almost always source code that gets compiled. On a modern Mac it installs YouTube-DL in about 6-12 seconds. On my slower macs, err between 30s-1.5mins. Any idea about creating binaries on another machine (i.e. offloading the compiling process)? – Tmanok Jan 2 at 16:06
  • 1
    @Tmanok Hmm.. I'm not sure where exactly the difference in build time comes from, but for the specific example you gave, it probably doesn't have to do with compilation, the whole thing seems to be in python, brew install youtube-dl will also simply download the tarball from GitHub and place binaries and supporting files appropriately. – user3052786 Jan 3 at 4:45
  • Ok, I suppose I'll continue learning about software compiling. Unfortunately I'm a network and electronics guy, not a programmer or software developer by more modern terms. Thank you for your help :) – Tmanok Jan 3 at 16:41
  • 1
    @Tmanok Hey, no problem, and happy new year! but just to be clear, I wasn't implying you need to be more knowledgeable. Different software often need to be set up differently on each system, e.g. in different paths, or with different permissions. People can't be expected to understand the build process for every single package, and brew is good at doing this for you. But, it needs to know about (as well as have access to) your system to do its job. If it's only a few packages that you notice takes a long time (llvm comes to mind) then bottling may well be a solution. – user3052786 Jan 4 at 7:17
  • Thank you for the kind reply! Happy new year to you as well :) – Tmanok Jan 4 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .