how to install specific version of software on mac using brew

C++
$ brew install [email protected]
brew switch node 0.4.12
brew switch node 0.6.5
brew switch [formula] [version]

Source

Also in C++: