Closed marcprux closed 2 years ago
We work around this limitation by downloading the ruby version of the formula locally and then executing brew info --json=v2 --cask <formula>.rb
to get the actual url & sha256 for the current architecture and language. It's not ideal since we need to fork the brew
process before the first time we download something, but it works.
When installing an app from the "Homebrew casks" catalog on an ARM Mac, the installation sometimes seems to freeze at around 75%, although it eventually completes. The catalog view looks like:
The issue is that the we pre-download the expected artifact so we can support progress monitoring & cancellation (as well as provide a reasonable user-facing error if the checksum fails), and then we fork
brew
to complete the installation. However, the JSON API athttps://formulae.brew.sh/api/cask.json
only ever lists the Intel version of any cask (due to https://github.com/Homebrew/brew/issues/12786), so when we forkbrew
to complete the installation, it doesn't utilize the pre-cached Intel version, but instead downloads the ARM version, which means that the two separate cask artifacts are downloaded.Ideally the cask formula would be enhanced to list all the artifact architectures (and associated sha256 checksums), but in the meantime we could generate the JSON locally (which will use the local architecture) to “pre-flight” the cask. E.g.,
brew info --json=v2 --casks signal
will result in:Alternatively, we could do some simplistic parsing of the ruby to come up with all the possible permutations of the cask artifact that will be installed: