Homebrew / homebrew-bundle

📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.
MIT License
5.36k stars 288 forks source link

brew bundle diff #790

Closed jamesdh closed 4 years ago

jamesdh commented 4 years ago

Ive built some "infrastructure as code" automation using Ansible + Homebrew for configuring my personal laptop (see here). Ideally I'd be able to run it every evening and see a "diff" of any changes, including any apps I may have installed that aren't represented in my infrastructure code.

Currently, I can do brew bundle check against my Brewfiles and that will confirm that I have everything installed that is listed in my Brewfiles. But I can't find a way to confirm if I have anything installed that's not in my Brewfile. E.g. a brew bundle diff command that would successfully return if installed apps matches the Brewfile(s), or fail with a list of differences.

Any thoughts on this?

MikeMcQuaid commented 4 years ago

But I can't find a way to confirm if I have anything installed that's not in my Brewfile.

brew bundle cleanup will do this for you.

jamesdh commented 4 years ago

@MikeMcQuaid ahh thanks! I missed that. Although I don't want to uninstall them, I just want the diff so then I can decide if I should uninstall it or add it to my IaC. Essentially something like brew bundle cleanup --check if there were such a thing.

jamesdh commented 4 years ago

@MikeMcQuaid when I try cleanup, it prints out the brews and casks that would be uninstalled, but it doesn't actually give an option to uninstall them. Is that intended? The docs for the command imply that it would actually do so, but I'm guessing the intent is to simply list them.

Also, it appears the command doesn't account for mas items in the Brewfile.

MikeMcQuaid commented 4 years ago

@MikeMcQuaid when I try cleanup, it prints out the brews and casks that would be uninstalled, but it doesn't actually give an option to uninstall them. Is that intended? The docs for the command imply that it would actually do so, but I'm guessing the intent is to simply list them.

Yes, that's intended.

Also, it appears the command doesn't account for mas items in the Brewfile.

We'd consider a PR to improve/fix this.