Closed obrientg closed 1 week ago
There seems something wrong happened when it tries to get apps information.
Could you please try following commands and give me outputs?
mdfind 'kMDItemAppStoreHasReceipt=1'
for app in $(mdfind 'kMDItemAppStoreHasReceipt=1');do echo $app;mdls -attr kMDItemAppStoreAdamID -attr kMDItemVersion $app;done
Sure
mdfind 'kMDItemAppStoreHasReceipt=1'
/Applications/Mattermost.app /Applications/Keynote.app /Applications/Numbers.app /Applications/iMovie.app /Applications/GarageBand.app /Applications/Pages.app /Applications/WireGuard.app
but if I run mdfind 'kMDItemAppStoreHasReceipt=1' for app in $(mdfind 'kMDItemAppStoreHasReceipt=1');do echo $app;mdls -attr kMDItemAppStoreAdamID -attr kMDItemVersion $app;done
-bash: syntax error near unexpected token `do'
or run
mdfind 'kMDItemAppStoreHasReceipt=1' for app in $(mdfind 'kMDItemAppStoreHasReceipt=1');
Unknown option -
Usage: mdfind [-live] [-count] [-onlyin directory] [-name fileName | -s smartFolderName | query] list the files matching the query query can be an expression or a sequence of words
-attr
Fetches the value of the specified attribute -count Query only reports matching items count -onlyin Search only within given directory -live Query should stay active -name Search on file name only -reprint Reprint results on live update -s Show contents of smart folder -0 Use NUL (``\0'') as a path separator, for use with xargs -0. example: mdfind image example: mdfind -onlyin ~ image example: mdfind -name stdlib.h example: mdfind "kMDItemAuthor == 'MyFavoriteAuthor'" example: mdfind -live MyFavoriteAuthor
Could you please try (starting from for
)?:
for app in $(mdfind 'kMDItemAppStoreHasReceipt=1');do echo $app;mdls -attr kMDItemAppStoreAdamID -attr kMDItemVersion $app;done
As requested, still errors:
$ for app in $(mdfind 'kMDItemAppStoreHasReceipt=1');do echo $app;mdls -attr kMDItemAppStoreAdamID -attr
/Applications/Mattermost.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
/Applications/Keynote.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
/Applications/Numbers.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
/Applications/iMovie.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
/Applications/GarageBand.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
/Applications/Pages.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
/Applications/WireGuard.app mdls: unrecognized option `-attr'
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path list the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -name example: mdls ~/Pictures/Birthday.jpg example: mdls -name Keyword ~/Pictures/Birthday.jpg
It seems you are using old macOS?
Arguments for mdls
was changed around macOS 12 (though I'm not sure exactly when it is).
Previously, it uses -name
to set attributes, but current version uses -attr
.
Maybe you will succeed with following command:
for app in $(mdfind 'kMDItemAppStoreHasReceipt=1');do echo $app;mdls -name kMDItemAppStoreAdamID -name kMDItemVersion $app;done
If it results like:
/Applications/iMovie.app
kMDItemAppStoreAdamID = 408981434
kMDItemVersion = "10.4.2"
/Applications/Pages.app
kMDItemAppStoreAdamID = 409201541
kMDItemVersion = "14.2"
...
I can try to implement an older mdls support. (Though I'm not sure everything else works fine or not in the old os.)
My current environment is like:
$ sw_vers
ProductName: macOS
ProductVersion: 14.7.1
BuildVersion: 23H222
$ mdls
(null): no filename specified!
usage: mdls [-s][-attr attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path
list the values of one or all the attributes of the specified file
-attr -n : fetch specific attribute
-raw -r : don't print attribute names before values
-nullMarker -m : substitute this string for null attributes in raw mode
-plist -p : output attributes in XML format to file. Use - to write to stdout
option -plist is incompatible with options -raw, -nullMarker, and -attr
-sdb -s : implies -attr _kMDItemSDBInfoexample: mdls ~/Pictures/Birthday.jpg
example: mdls -attr Keyword ~/Pictures/Birthday.jpg
$ which mdls
/usr/bin/mdls
Note the first post:
The current system I am working on is a MacBookPro11,5 running Monterey (12.7.6),
So not "old" per se.
Per sw_ver CLI:
ProductName: macOS ProductVersion: 12.7.6 BuildVersion: 21H1320
That CLI provided the following results:
/Applications/Mattermost.app kMDItemAppStoreAdamID = 1614666244 kMDItemVersion = "5.9.0" /Applications/Keynote.app kMDItemAppStoreAdamID = 409183694 kMDItemVersion = "13.1" /Applications/Numbers.app kMDItemAppStoreAdamID = 409203825 kMDItemVersion = "13.1" /Applications/iMovie.app kMDItemAppStoreAdamID = 408981434 kMDItemVersion = "10.3.8" /Applications/GarageBand.app kMDItemAppStoreAdamID = 682658836 kMDItemVersion = "10.4.8" /Applications/Pages.app kMDItemAppStoreAdamID = 409201541 kMDItemVersion = "13.1" /Applications/WireGuard.app kMDItemAppStoreAdamID = 1451685025 kMDItemVersion = "1.0.16"
Huzzah! Hope this now helps clarify.
If not supporting "older" versions, at least add to the FAQ and start page which OS X versions this tool supports to save everyone some time.
Thanks for checking.
It appears that Apple has already dropped support for macOS Monterey, as its last security update was in July, while more recent versions received updates in September. Therefore, it’s recommended to upgrade your OS as soon as possible.
Additionally, Homebrew supports macOS Ventura (13) and later versions, as noted here: https://docs.brew.sh/Installation
Anyways, I’ve added documentation about macOS version requirements on the Requirements page: https://homebrew-file.readthedocs.io/en/latest/requirements.html
You may be able to use brew-file (excluding casklist
)
by setting environment variable HOMEBREW_BREWFILE_APPSTORE=0
.
This setting drops AppStore related applications' management.
casklist
subcommand is to check applications including AppStore's ones, therefore it does not work on macOS 12.
I found that https://github.com/Homebrew/homebrew-bundle project supports the current version of OS X on this MacBook Pro, and is helping me with the migration. It may be worth mentioning it in the documentation as a different option for those in a similar situation to mine.
Homebrew supports macOS 13 or later, so tools for Homebrew should also support at least macOS 13.
While bundle can create a Brewfile and install packages from it, the main concept behind brew-file is to manage the Brewfile itself and make it easy to share, for example, through GitHub. For this reason, I don’t think bundle is a true alternative to brew-file.
Hello! I am working on getting brew-file running on various macbook pro's I own to make administration easier - and when configuring a new system. The current system I am working on is a MacBookPro11,5 running Monterey (12.7.6), with brew & all packages up to date (ran brew update/upgrade before starting this process).
I have gone through all the documentation posted on https://homebrew-file.readthedocs.io/en/latest/usage.html and the FAQ), but I am getting similar IndexError's when running casklist, or when looking to create the brew-file (which casklist seems to be the first step):
Your assistance and insights would be appreciated - thank you
(edited for formatting)