When installing a package with homebrew, you’ll most likely get the latest version.
Usually that’s okay, but what if you need an older version of that package?
In such a scenario, you can install from an older formula url:
$ brew install <formula_url>
Let’s say you want to install
chromedriver version 2.22.
chromedriver if it’s already installed:
$ brew rm chromedriver
The formula filename should be
Open the file in GitHub and click History.
Use the commit message as a reference to find the version that you desire:
Open the file at that point in history.
Finally, click on Raw to get the url of the raw file.
Copy it and paste it after
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/14c7f7415bd2feaf49def7ad53fe5f6eb32f9265/Formula/chromedriver.rb
Voila, you have an older version of
chromedriver installed with brew!