How to setup a Remote homebrew repository

Batel Tova
2022-07-07 09:20

1. Create a docker remote repository, named homebrew with the following URL:https://ghcr.io as the following example:

User-added image

2. Add the environment variable HOMEBREW_ARTIFACT_DOMAIN, as follows:

export HOMEBREW_ARTIFACT_DOMAIN=<artifactory-url>/artifactory/homebrewFor authenticated access:
export HOMEBREW_DOCKER_REGISTRY_TOKEN=<artifactory-access-token>

Note: Don't use a Subdomain / Ports style Docker URL with Homebrew. The normal Artifactory URL with /homebrew on the end should work with the Brew client, for example "https://artifactory.com/homebrew".

3. Now each brew install command will go through Artifactory like the following example:

$brew install wget

$brew install wget

 

Homebrew Cask Support
Artifactory supports mirroring Bottles and Formulas by proxying the GitHub Container Registry (https://ghcr.io). Casks are provided by the package author and will be located at arbitrary URL locations which Artifactory won't be able to proxy. Instead you should use standard Forward Proxy environment variables to download these files. 

Please note that there is a bug fix around Cask behavior in Homebrew 3.4.12, earlier versions of the client use the HOMEBREW_BOTTLE_DOMAIN URL to download casks rather than a separate Forward Proxy.