How to change brew core from mirror to official?

#1

For stability and for increased build performance by default the macOS VMs have brew installed but the main source is changed from the official https://github.com/Homebrew/homebrew-core to the Bitrise maintained mirror https://github.com/bitrise-io/homebrew-core (and similarly for homebrew cask changed from https://github.com/Homebrew/homebrew-cask to https://github.com/bitrise-io/homebrew-cask ).

The mirror is updated frequently but it follows the official repo with a delay.

IMPORTANT NOTE: GitHub throttles homebrew repos, which might easily make some workflows flaky. You should only change back to the official brew core formulae repo if you really need to!

If for some reason you’d need a brew formulae that’s so new that it’s not available in the Bitrise mirror, or if you’d need a newer version of the formulae that’s not yet available in the Bitrise mirror you can use a Script step to change the brew formulae source repository from the Bitrise mirror back to the official one:

#!/usr/bin/env bash
set -ex

cd "$(brew --repository)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
brew update
brew install THE-FORMULAE-YOU-WANT-TO-INSTALL
# or if you just want to upgrade
brew upgrade THE-FORMULAE-YOU-WANT-TO-UPGRADE

This script changes the source of the main brew repository. If you need a newer formulae from brew cask you can use this Script instead:

#!/usr/bin/env bash
set -ex

cd "$(brew --repository)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://github.com/Homebrew/homebrew-cask.git
brew update
brew install THE-FORMULAE-YOU-WANT-TO-INSTALL
# or if you just want to upgrade
brew upgrade THE-FORMULAE-YOU-WANT-TO-UPGRADE
1 Like

#2

Can you add the option to use Brew v2.6.2, since they decided that they hate their users so much that they removed brew switch?

0 Likes

#3

Hello @edward_8 :wave:

Currently we have a static version of Brew on the Bitrise VM-s, which by default cannot be modified, only via the script step that @viktorbenei mentioned. :slight_smile:

0 Likes