Skip to content

Instantly share code, notes, and snippets.

Created August 28, 2013 09:13
What would you like to do?
Install specific version of Homebrew formula
# Install specific version of Homebrew formula
# usage example:
# $ brew-install ssh-copy-id 6.0p1
function brew-install {
local formula version formula_hash
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
Copy link

great formula!!! Thanks!

Copy link

tnine commented Oct 23, 2013

Dumb question, but where do I install this so that it's picked up on the path?

Copy link

@tnine just add the code into ~/.bash_profile

Copy link

Been looking everywhere for something like this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment