Possible for Brewfile track a baseline set of Mac App Store apps, but not add new ones?
Closed this issue · 14 comments
Is there a way to track a base set of mas
apps in brewfile
, but ignore any additional apps that get installed? I generally disable HOMEBREW_BREWFILE_APPSTORE
, and this is why. I don't want every single app I install to get added to my brewfile.
If not, I wonder if having an additional setting would be possible? E.g.,
HOMEBREW_BREWFILE_APPSTORE=0 # Disable App Store
HOMEBREW_BREWFILE_APPSTORE=1 # Enable App Store
HOMEBREW_BREWFILE_APPSTORE=2 # Don't add additional App Store apps to Brewfile
So, you have minimum apps list which should be installed at all of your Mac,
but you install some apps which should not be installed at another Mac, right?
With current brew-file system,
maybe it is better to separate Brewfile:
- Set
HOMEBREW_BREWFILE_APPSTORE = 1
. - Do
brew init
to make Brewfile includingmas
apps. - Make
mas
apps only Brewfile from it, and remove some if needed. - Keep the file as you (push it in another GitHub repository, in Dropbox, write in Evernote, or etc...)
- Set
HOMEBREW_BREWFILE_APPSTORE = 0
and dobrew init
.
Then, usually use Brewfile without mas apps.
And if you get new Mac,
put your mas
Brewfile like ~/Brewfile.mas, and run
brew file install -f ~/Brwefile.mas
.
There are some manual procedure,
but I think this accomplishs what you want.
On the other hand,
HOMEBREW_BREWFILE_APPSTORE=2 # Don't add additional App Store apps to Brewfile
I think this option is harmless for current functions (if I can correctly implement...),
I will try to implement it.
I think this is a workable approach:
brew file install -f ~/Brewfile.mas
I'll try working with that if you'd rather not change the behavior of mas
apps.
sorry for the late work.
Anyway, I've tried to implemented HOMEBREW_BREWFILE_APPSTORE=2
option,
and now it is available in the master branch.
You can enable this option by setting environmental variable:
export HOMEBREW_BREWFILE_APPSTORE=2
or using command line option
$ brew file init --appstore 2
Although it works as expected as long as I checked,
I want to ask you to check the functions before putting them in the release.
Could you please try the new version?
You can check it by cloning the repository and using bin/brew-file
of master branch directly.
Thank you so much for working on this feature, especially if this isn't something that you personally wanted or needed.
I have a question: when I run brew-file
out of a local clone of master, it re-taps everything and attempts to reinstall all of my casks.
Is this because I'm running brew-file
from a location different from where homebrew is installed? Or is this a bug?
um... it should be a bug, sorry.
Which subcommand do you use when it happened?
maybe brew-file install
?
Could you please check other subcommands, such
brew-file get_files
brew-file help
brew-file init
etc... (better to make a backup of Brewfile before trying them...)
It was brew-file update
. Here's truncated output:
./bin/brew-file update
$ brew update
Already up-to-date.
$ brew upgrade --fetch-HEAD
$ brew cask upgrade
Warning: Calling brew cask upgrade is deprecated! Use brew upgrade --cask instead.
$ brew tap homebrew/core
==> Unshallowing homebrew/core
$ brew tap homebrew/bundle
==> Unshallowing homebrew/bundle
$ brew tap homebrew/cask-drivers
==> Unshallowing homebrew/cask-drivers
$ brew tap homebrew/cask-fonts
==> Unshallowing homebrew/cask-fonts
$ brew tap homebrew/cask-versions
==> Unshallowing homebrew/cask-versions
$ brew tap homebrew/cask
==> Unshallowing homebrew/cask
$ brew tap rcmdnk/file
==> Unshallowing rcmdnk/file
$ brew tap teamookla/speedtest
$ brew tap vitorgalvao/tiny-scripts
==> Unshallowing vitorgalvao/tiny-scripts
$ brew cask install --force font-hack-nerd-font
The other commands:
./bin/brew-file install
: no output
./bin/brew-file get_files
:
/Users/zach/.dotfiles/brewfile/Brewfile
/Users/zach/.dotfiles/brewfile/osarian.Brewfile
/Users/zach/.dotfiles/brewfile/${HOSTNMAME}-mas.Brewfile #< -- this is weird because it should have expanded to `osarian-mas.Brewfile`
brew-file help
:
usage: brew-file [-f INPUT] [-b BACKUP] [-F FORM] [--leaves] [--on_request] [--top_packages TOP_PACKAGES] [-U] [-r REPO] [-n] [--caskonly] [--appstore APPSTORE]
[--no_appstore] [-C] [-y] [-V VERBOSE] [-h]
[command] ...
Brew-file: Manager for packages of Homebrew
https://github.com/rcmdnk/homebrew-file
<truncated>
./bin/brew-file init
/Users/zach/.dotfiles/brewfile/Brewfile is already there.
####################################################
# Initialize /Users/zach/.dotfiles/brewfile/Brewfile
####################################################
############################################################
# You can edit /Users/zach/.dotfiles/brewfile/Brewfile with:
# $ brew-file edit
############################################################
The init
command deleted the "Additional files" section from Brewfile:
git diff brewfile/Brewfile
diff --git a/brewfile/Brewfile b/brewfile/Brewfile
index a98009c..adff6f4 100644
--- a/brewfile/Brewfile
+++ b/brewfile/Brewfile
@@ -72,6 +72,7 @@ tap homebrew/cask-versions
tap homebrew/cask
cask 1password-cli
cask adoptopenjdk
+cask docker
cask filemon
cask ghidra
cask hfsleuth
@@ -91,7 +92,3 @@ brew speedtest
tap vitorgalvao/tiny-scripts
brew cask-repair
-
-# Additional files
-file ./${HOSTNAME}.Brewfile
-file ./${HOSTNMAME}-mas.Brewfile
ok, I found a bug in brew-file update
.
Disappearance "Additional files" was also made by upgrade
(not by init
, they were already deleted by upgrade
).
Current master version should work...
The following commands seem to work as expected:
brew-file update
brew-file install
brew-file help
brew-file get_files
The brew-file init
command doesn't seem to be working quite right:
./bin/brew-file init
/Users/zach/.dotfiles/brewfile/Brewfile is already there.
[WARNING]: Input file /Users/zach/.dotfiles/brewfile/Brewfile is not found.
Do you want to initialize from installed packages? [y/n]: y
[WARNING]: Input file /Users/zach/.dotfiles/brewfile/Brewfile is not found.
Do you want to initialize from installed packages? [y/n]: y
[WARNING]: Input file /Users/zach/.dotfiles/brewfile/Brewfile is not found.
Do you want to initialize from installed packages? [y/n]: y
[WARNING]: Input file /Users/zach/.dotfiles/brewfile/Brewfile is not found.
Do you want to initialize from installed packages? [y/n]: y
[WARNING]: Input file /Users/zach/.dotfiles/brewfile/Brewfile is not found.
Do you want to initialize from installed packages? [y/n]: y
[WARNING]: Input file /Users/zach/.dotfiles/brewfile/Brewfile is not found.
Do you want to initialize from installed packages? [y/n]: n
[ERROR]: Ok, please prepare brewfile
[ERROR]: or you can initialize /Users/zach/.dotfiles/brewfile/Brewfile with:
[ERROR]: $ brew-file init
sorry, there was an another bug for HOMEBREW_BREWFILE_APPSTORE=2, which make such a loop.
I pushed fixed version in the master branch.
Could you please try again?
I updated master and all the commands seem to work.
Thank you! I'm sorry this was a lot of trouble for you.
ok, thanks for debugging!
It is now available in the release, i.e. brew file update
will install the version.
Please do not hesitate to send issues which make the tool better!
Thank you! I can't wait to try it out.
It looks like brew-file.rb
is still installing version 8.0.5, though.
oops! sry, I forgot to update the formula.
the file has been updated now.
Awesome; this works great! Thank you for working on this.