Joldnine / joldnine.github.io

My github.io blog repo. https://joldnine.github.io
2 stars 1 forks source link

How install a specific version of formula (package) in Homebrew #44

Open Joldnine opened 3 years ago

Joldnine commented 3 years ago

Step 1: Clone the Homebrew repository

git clone https://github.com/Homebrew/homebrew-core.git

Step 2: Log the formula history

cd homebrew-core git log master -- Formula/git.rb

Step 3: From the history, find the commit hash of the version you want to install

commit 0c49ceffe4944b095da4d0c39a6b8499714d0df8 Author: BrewTestBot 1589480+BrewTestBot@users.noreply.github.com Date: Tue Aug 17 04:07:34 2021 +0000 git: update 2.33.0 bottle.

Note the first 10 char of the commit hash, which will be 0c49ceffe4 in the example

Step 4: Install the specified version referenced by SHA

brew install https://github.com/Homebrew/homebrew-core/raw/0c49ceffe4/Formula/git.rb

You can also use the full SHA of the commit.