How do I install a specific version of a formula in homebrew? For example, postgresql-8.4.4 instead of the latest 9.0.
You can use the strategy of identifying the formula and a particular commit in the history of the formula that matches the version of the package you'd like to install.
Go to https://github.com/Homebrew/homebrew-core
Press t
on your keyboard to activate the file finder.
Identify a formula that looks most relevant, perhaps: Formula/mysql.rb
, bringing you to a forumla file location: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb.
Look at the revision history by clicking on the History
button, which is located at https://github.com/Homebrew/homebrew-core/commits/master/Formula/mysql.rb. If you're interested in MySQL 5.7.10, you might want to click the latest revision prior to 5.7.11, which navigates to a GitHub commit:
https://github.com/Homebrew/homebrew-core/commit/c77882756a832ac1d87e7396c114158e5619016c#Formula/mysql.rb
NOTE: You may have to view the commit history in your console per GitHub's suggestion if the commit history does not load in your browser. Replace the commit SHA above in the URL if you're interested in seeing that commit on GitHub. Alternatively, skip to step 7, below.
Click the "View" button to view the source for the mysql.rb file after the commit was applied.
Then click the "Raw" button to view the raw source.
Copy the URL. Alternatively, build the URL yourself with the mysql.rb
file name to identify your formula and the particular version of that formula (identified by the commmit SHA in the URL below).
https://raw.githubusercontent.com/Homebrew/homebrew-core/c77882756a832ac1d87e7396c114158e5619016c/Formula/mysql.rb
Install it with $ brew install [URL from step 7]
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/c77882756a832ac1d87e7396c114158e5619016c/Formula/mysql.rb
NOTE: This answer was updated to account for the removal of the braumeister.org website. The same principle applies, braumeister had simply provided a beginner-friendly way to navigate formula versions.