Skip to content

Instantly share code, notes, and snippets.

@brunneis
Last active August 22, 2023 11:05
Show Gist options
  • Save brunneis/e7b1d40526c085d7760bf9225e4b3cfe to your computer and use it in GitHub Desktop.
Save brunneis/e7b1d40526c085d7760bf9225e4b3cfe to your computer and use it in GitHub Desktop.
How to install an old version of a brew package
#!/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