Skip to content

Instantly share code, notes, and snippets.

@piscis
Last active December 15, 2015 12:49
Show Gist options
  • Save piscis/5263116 to your computer and use it in GitHub Desktop.
Save piscis/5263116 to your computer and use it in GitHub Desktop.
Find all available versions of a homebrew formula and resove "fatal: '/usr/local/Library/Formula/XXX.rb' is outside repository" error
# Allways a good idea to sync with the formular repository first
alex$ brew update
# List available version
alex$ brew versions zmq
3.2.2 git checkout ab8de4b /usr/local/Library/Formula/zeromq.rb
2.2.0 git checkout 6a2e6ef /usr/local/Library/Formula/zeromq.rb
2.1.11 git checkout 497b13a /usr/local/Library/Formula/zeromq.rb
2.1.10 git checkout 4c8ed3a /usr/local/Library/Formula/zeromq.rb
2.1.9 git checkout 381c97f /usr/local/Library/Formula/zeromq.rb
2.1.7 git checkout ed41f79 /usr/local/Library/Formula/zeromq.rb
2.1.8 git checkout 8e045d5 /usr/local/Library/Formula/zeromq.rb
2.1.6 git checkout 460a168 /usr/local/Library/Formula/zeromq.rb
2.1.4 git checkout 83ed494 /usr/local/Library/Formula/zeromq.rb
2.1.3 git checkout f4a925d /usr/local/Library/Formula/zeromq.rb
2.1.2 git checkout 3017b39 /usr/local/Library/Formula/zeromq.rb
2.1.1 git checkout 0476235 /usr/local/Library/Formula/zeromq.rb
2.0.10 git checkout 00e1ae3 /usr/local/Library/Formula/zeromq.rb
2.0.9 git checkout 0527b6f /usr/local/Library/Formula/zeromq.rb
2.0.8 git checkout 1f252bf /usr/local/Library/Formula/zeromq.rb
2.0.7 git checkout ce8d2f5 /usr/local/Library/Formula/zeromq.rb
# Lets pick version 3.2.2 of the zmq formula
git checkout ab8de4b /usr/local/Library/Formula/zeromq.rb
# Then install the formula
alex$ brew install zmq
==> Installing zeromq dependency: pkg-config
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-
.....
# Troubleshooting
# If you get something like this
alex$ git checkout ab8de4b /usr/local/Library/Formula/zeromq.rb
fatal: '/usr/local/Library/Formula/zeromq.rb' is outside repository
# You might have local modification of that formular.
# This is how you can check it
alex$ cd /usr/local/Library/Formula/
itiny:Formula alex$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: zeromq.rb
#
# Revert your modifications
git checkout zeromq.rb
# Now you should be able to switch to the specific version e.g. for version 3.2.2
git checkout ab8de4b /usr/local/Library/Formula/zeromq.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment