Skip to content

Instantly share code, notes, and snippets.

@RyanJarv
Created January 23, 2022 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanJarv/fdc165e1b90cfe39325d958814510fbe to your computer and use it in GitHub Desktop.
Save RyanJarv/fdc165e1b90cfe39325d958814510fbe to your computer and use it in GitHub Desktop.
One liner for downloading home brew bottles
# Oneliner for copy/paste:
#
# NAME=libtool VERSION=2.4.6_4; OSX_CODENAME=big_sur; curl -o "${NAME}-${VERSION}.${OSX_CODENAME}.bottle.tar.gz" -L -H 'Authorization: Bearer QQ==' -XGET "https://ghcr.io/v2/homebrew/core/${NAME}/blobs/sha256:$(curl -H 'Accept: application/vnd.oci.image.index.v1+json' -H 'Authorization: Bearer QQ==' -XGET https://ghcr.io/v2/homebrew/core/${NAME}/manifests/${VERSION} | jq '.manifests|.[]|select(.annotations."org.opencontainers.image.ref.name" == "'"${VERSION}.${OSX_CODENAME}"'")|.annotations."sh.brew.bottle.digest"' -r)"
#
# Formatted version:
NAME=libtool
VERSION=2.4.6_4
OSX_CODENAME=big_sur
curl \
-o "${NAME}-${VERSION}.${OSX_CODENAME}.bottle.tar.gz" \
-L -H 'Authorization: Bearer QQ==' \
-XGET "https://ghcr.io/v2/homebrew/core/${NAME}/blobs/sha256:$( \
curl \
-H 'Accept: application/vnd.oci.image.index.v1+json' \
-H 'Authorization: Bearer QQ==' -XGET https://ghcr.io/v2/homebrew/core/${NAME}/manifests/${VERSION} \
| jq '.manifests|.[]|select(.annotations."org.opencontainers.image.ref.name" == "'"${VERSION}.${OSX_CODENAME}"'")|.annotations."sh.brew.bottle.digest"' -r
)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment