/homebrew-bottle-downloader

Download Homebrew binary packages recursively without installing Homebrew.

Primary LanguageSwiftApache License 2.0Apache-2.0

Homebrew bottle downloader

A command-line tool that enables you to download Homebrew binary packages (including their dependencies, and the dependencies of their dependencies...). You don't even have to install Homebrew.

How to use?

For instance, if you wish to download zstd for macOS Sonoma, simply input the command zxq zstd sonoma.

$ zxq zstd sonoma
curl -L -H "Authorization: Bearer QQ==" -o xz.tar.gz https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:bdd5146737d8a84b8a855d7b1bdc81cd2d20692c5d77810fa7472cd9bb41fb47
curl -L -H "Authorization: Bearer QQ==" -o zstd.tar.gz https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:2137fe12a266078c16b162342500c7efa263def709e6742bfb4bf8601a3f36af
curl -L -H "Authorization: Bearer QQ==" -o lz4.tar.gz https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:2bad368b2869db32b1b22cea76a6e65da2f4e599ac8ee327b4825d54c4579445

Then, you can download the bottles by running the curl command generated by the tool. (The current version only supports indirect downloading through curl, and I am still figuring out how to implement equivalent operations in Swift). If you wish to download bottles compiled for Apple Silicon, simply prepend arm64_ before the version number.

How to actually run the downloaded binary?

Adjust the DYLD_LIBRARY_PATH environment variable or use install_name_tool.

How to build?

swift build -c release

Or in Xcode -> Product -> Archive.

You can also use it similar to a shell script: swift Sources/main.swift xz sonoma.