Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install a Homebrew bottle designed for a different (previous) version of macOS

Tags:

homebrew

I haven't been able to find a way to install prior versions of software since the removal of the versions command and tap in Homebrew. I'm running macOS 10.14.3 (Mojave) on a 2008 Mac Pro (3,1). I've run into one or two Homebrew packages that assume I have a Nehalem processor, but my Penryn Xeon doesn’t' support some of the instructions.

After some troubleshooting, I was told to install a previous version of a bottle, but I can't find any instructions or documentation on how to specify a bottle version. Is there a way from within Homebrew to specify a bottle version? Preferably one that will allow me to use brew update in the future? The current method of brew install foo --build-bottle --build-arch=core2 isn't really ideal when someone else has already built an appropriate bottle.

like image 896
Dustin Wheeler Avatar asked Jan 26 '23 14:01

Dustin Wheeler


2 Answers

As of 2021, BinTray has closed down, and bottles are now stored as GitHub Packages instead.

You can download these using the following cURL invocation:

curl -L -H "Authorization: Bearer QQ==" -o x.tar.gz https://ghcr.io/v2/homebrew/core/NAME/blobs/sha256:HASH

...replacing NAME with the name of the package whose bottle you would like to download, and HASH with the SHA-256 identifier for the bottle you would like.

The hashes can be found in the formula file for the package, inside the bottle block. Each OS and architecture has a different hash:

class Gettext < Formula
  # ...

  bottle do
    sha256 arm64_monterey: "6e2c829031949c0cbd758d0701ed62c191387736e76a98a046c0619907632225"
    sha256 arm64_big_sur:  "339b62b52ba86dfa73091d37341104b46c01ae354ca425000732df689305442b"
    sha256 monterey:       "0e93b5264879cd5ece6efb644fd6320b0b96cce36de3901c1926e53f851d14c7"
    sha256 big_sur:        "a025e143fe3f5f7e24a936b8b0a4926acfdd025b11d62024e3d355c106536d56"
    sha256 catalina:       "cdea54f52b7c36ebcb5fe26a1cf736d7cd6fd5f2fd016dd8357a8624ffd6b5f8"
    sha256 mojave:         "99707d4dcc731faf980333365a694e9500f2f012f84c0bcb6d8cb5d620c2ce08"
    sha256 high_sierra:    "5ac5783e31205b92907b46bfaaa142620aea7ee3fc4d996876b0913fd2315695"
    sha256 x86_64_linux:   "33f840e667c6ee0f674adb279e644ca4a1b3cd1606894c85d9bbce1b5acc0273"
  end

  # ...
end
like image 113
Aaron Christiansen Avatar answered May 19 '23 02:05

Aaron Christiansen


In my case, I'm trying to build on MacOS 10.15 (Catalina) via Github build machines and I wanted to force install 10.14 (Mojave) bottles so that I could link against SDL2 for earlier OSes.

I was able to download the specific bottle file from bintray and install that manually.

curl -L https://bintray.com/homebrew/bottles/download_file?file_path=sdl2-2.0.10.mojave.bottle.tar.gz -o sdl2-2.0.10.mojave.bottle.tar.gz
brew install -f sdl2-2.0.10.mojave.bottle.tar.gz

It's not pretty, and unfortunately hardcodes the software version. I'd love to know if there's a way to tell brew "just use Mojave (or whatever OS) bottles if possible".

like image 28
digarok Avatar answered May 19 '23 02:05

digarok