Using the case of installing Python 2.7.9 instead of the latest 2.7.10, previously I could simply use brew versions python and see all of the versions of Python
homebrew-versions used to be the easiest way to do this, but homebrew-versions has been deprecated and is no longer available in the current version of homebrew.
To find what versions are readily available, use the following command:
brew search python
to list out all of the available python packages which would display old versions like python@2 and then you could install them by using:
brew install python@2
If you have already installed the older version of the formula and have not removed it you can simply switch the symlinks to reference it using a brew command.
brew switch python 2.7.9
This command would switch you to version 2.7.9
brew switch python 2.7.10
This would switch you back to version 2.7.10
If you do not still have the older version available on your system there is another method you could try but it is more difficult and almost certainly unsupported by Homebrew so if you end up with issues you may not be able to rely on their help.
https://github.com/Homebrew/homebrew-core/commits/master/Formul/ should take you to the commit history of that formula. For your example of installing python 2.7.9 you would do the following:
https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb1681e19 in this example)git checkout 1681e19 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb into the terminalFrom this point you would do whatever you would normally do to install the older version of python with the old versions method. This appears to be all the old method was doing.