-
-
Save warantesbr/47fb81cac299a6d1979d to your computer and use it in GitHub Desktop.
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
# Install specific version of Homebrew formula | |
# usage example: | |
# $ brew-install ssh-copy-id 6.0p1 | |
function brew-install { | |
local formula version formula_hash | |
formula=$1 | |
version=$2 | |
cd `brew --prefix` | |
git_last_commit_id=`git rev-parse --short HEAD` | |
formula_hash=`brew versions $formula|grep $version|awk '{print $4}'` | |
echo brew install $formula with version $version $formula_hash | |
git checkout $formula_hash Library/Formula/$formula.rb | |
brew install $formula | |
brew switch $formula $version | |
git checkout $git_last_commit_id Library/Formula/$formula.rb # reset formula | |
cd - # got back to previous dir | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment