4

I am trying to install an older git version from brew.

I have installed git 2.33.1

▶ brew info git
git: stable 2.33.0 (bottled), HEAD
Distributed revision control system
https://git-scm.com
/usr/local/Cellar/git/2.33.0_1 (1,508 files, 42MB) *
  Poured from bottle on 2021-10-08 at 12:06:00
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/git.rb
License: GPL-2.0-only
==> Dependencies
Required: gettext ✔, pcre2 ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Analytics
install: 198,758 (30 days), 658,960 (90 days), 2,607,801 (365 days)
install-on-request: 194,065 (30 days), 644,952 (90 days), 2,558,858 (365 days)
build-error: 0 (30 days)

I want (for some troubleshooting purposes) an older version, namely 2.25.1

Why does it seem like there are no other (older) versions available?

▶ brew install [email protected]
Warning: No available formula or cask with the name "[email protected]".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

I have also tried the suggestions of this older SO topic with no luck whatsoever.

1
  • 1
    Probably, the brew maintainers just don't have that particular old version stored anywhere. You may wish to build Git directly from source, rather than using brew (or really "in addition to" since you'll need a ton of stuff more than just the standard macOS developer software).
    – torek
    Commented Oct 8, 2021 at 20:45

1 Answer 1

7

https://docs.brew.sh/Tips-N'-Tricks#installing-previous-versions-of-formulae

The supported method of installing specific versions of some formulae is to see if there is a versioned formula (e.g. gcc@7) available. If the version you’re looking for isn’t available, consider using brew extract.

Run these commands to create a tap named $USER/local-tap, extract git 2.25.1 into your tap, and install:

brew tap-new --no-git $USER/local-tap
brew extract --version=2.25.1 git $USER/local-tap
brew install [email protected]
/usr/local/opt/[email protected]/bin/git --version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.