1
2
I often find myself switching to a specific version of a package installed with homebrew when switching projects.
$ cd ~/Desktop/projects/project1
$ brew switch phantomjs 2.0.0
Cleaning /usr/local/Cellar/phantomjs/1.9.7_1
Cleaning /usr/local/Cellar/phantomjs/1.9.8
Cleaning /usr/local/Cellar/phantomjs/2.0.0
2 links created for /usr/local/Cellar/phantomjs/2.0.0
And then when changing project:
$ cd ~/Desktop/projects/project2
$ brew switch phantomjs 1.9.8
Cleaning /usr/local/Cellar/phantomjs/1.9.7_1
Cleaning /usr/local/Cellar/phantomjs/1.9.8
Cleaning /usr/local/Cellar/phantomjs/2.0.0
2 links created for /usr/local/Cellar/phantomjs/1.9.8
Is it somehow possible to automate this so that I can force brew
to automatically switch to a specified version when inside a certain project?
Would be nice if one could create a file called something like .homebrew
inside the target directory and from there specify required packages and versions.