Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I save and version brew packages?

Tags:

macos

homebrew

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. :)

like image 332
Dawson Avatar asked Dec 01 '25 05:12

Dawson


1 Answers

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
like image 96
bfontaine Avatar answered Dec 04 '25 06:12

bfontaine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!