How to setup a Remote homebrew repository

Batel Tova
2022-01-13 00:47

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>/homebrew
For 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
While Artifactory can handle proxying Homebrew Bottles and Formulas, at this time it can't handle fetching Casks. The issue is that Cask dependencies can use any URL, and Artifactory's Docker repository can't serve as a generic Forward Proxy:

==> Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.2.0/powershell-7.2.0-osx[…]-
==> Downloading from https://artifactory.com/homebrew/https://github.com/PowerShell/Powe <———
   curl: (22) The requested URL returned error: 400