Reputation: 4403
I am used to installing packages and libraries via tools like npm, pip, and gem. These tools allow me to track the installed packages in some form or another (package.json, requirements.txt, or a Gemfile). This can then be checked into a repo and versioned.
I have a dotfiles repo on Github that I like to use as way to version control my machine configuration and I was wondering if there was a way to version control installed brew packages? If so how is this done? Something like brew install --save
is what I am hoping for. :)
Upvotes: 3
Views: 3468
Reputation: 10379
Here is a simple way for any *nix based system:
#create list of installed packages
brew list | xargs -L1 > Brewfile
# install packages
cat Brewfile | xargs brew
This is not as sophisticated as Homebrew bundle but it does the job if you're in a hurry.
Upvotes: 1
Reputation: 19869
You’re looking for Homebrew Bundle.
It lets you keep track of installed formulae (packages) in a Brewfile
.
You can then dump all the installed formulae in it with brew bundle dump
, install all formulae from a bundle with brew bundle
, and remove all installed formulae that aren’t listed in the bundle with brew bundle cleanup
.
The syntax is very similar to Bundler’s, so it’s easy to edit the file by yourself.
It support both local Brewfiles (e.g. one per project) and a global one (~/.Brewfile
).
Install it with:
$ brew tap homebrew/bundle
Upvotes: 8