Last active
August 22, 2023 11:05
-
-
Save brunneis/e7b1d40526c085d7760bf9225e4b3cfe to your computer and use it in GitHub Desktop.
How to install an old version of a brew package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 6.29.3 ~ https://github.com/twmht/python-rocksdb/issues/47#issuecomment-1678961102 | |
PACKAGE_NAME=rocksdb | |
PACKAGE_VERSION=6.29.3 | |
# Clone the main Homebrew repo | |
git clone https://github.com/Homebrew/homebrew-core | |
cd homebrew-core | |
# Find the commit hash associated with the version we want (b3597b729a2) | |
commit=$(git log --oneline -- Formula/$PACKAGE_NAME.rb | grep -m 1 $PACKAGE_VERSION | cut -d ' ' -f1) | |
# Checkout the selected commit | |
git checkout $commit | |
# Install the package | |
brew install Formula/$PACKAGE_NAME.rb | |
# Fix the package version | |
brew pin $PACKAGE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment