Sometimes brew updates break your computer or a piece of software. This is usually really unpleasant as it can take some time to diagnose which formula at which version did so. Even if you can diagnose, it's not very clear how to roll back homebrew softwares to previous versions.
The process is as such:
- Brew uninstall the software in question
- Replace the brew formula for that software with an older version
- Brew install your software. Brew will read your formula and install the older, non-toxic software.
This is the hardest part. Brew isn't very transparent about where and how these formula are stored.
- Each formula is stored as a .rb file
- From a friend's computer or homebrew/versions (https://github.com/Homebrew/homebrew-versions) get the old .rb file for your software (e.g. qt.rb)
- Go to /usr/local/Library/Formula
- Copy out the existing .rb file for your software just in case. Store it somewhere safe
- Now overwrite the .rb file in your Formula folder with the older .rb file.
- Done!
If you really want to, you can edit the .rb file instead of replacing it.
In that case, you should replace the key items under stable do and bottle do. These are located at the top of the .rb file. New urls should be provided for url and mirror and you will need to find the unique homebrew update text string that goes under sha256. If you have an older version of OS X installed you will also need to find the string that's appropriate for that version.
Note: finding these strings is not fun. I haven't found a reliable source (comment on this gist if you know of one).
Example
stable do
url "https://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz"
mirror "https://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz"
sha256 "e2882295097e47fe089f8ac741a95fef47e0a73a3f3cdf21b56990638f626ea0"
end
bottle do
sha256 "540e72bee0f660e0aeebe84ce04408fd45642fd987e304c9591b2648af55672b" => :yosemite
sha256 "27e20d9f5b17df87e49ae9d6fe15105ac83a79b2a364884cdfd17e55e02d6ea1" => :mavericks
sha256 "c03ff74ad662f1aafb048f6d016f76bf510da328752453ae4b7e6aaa6402e9b9" => :mountain_lion
end
Homebrew versions is a (very) partial record of previous homebrews. They only seem to stash major formula there (e.g. postgres) and it doesn't seem to be taken seriously as a repository for formula rollbacks. A friend's computer is likely a more viable option for the .rb files.