Make a list of your current applications along with the date you last used them.
- Get the relevant metadata attributes for Applications to mimic "Date last opened" in Finder using mdls
- Convert plist xml output to json using yq
- With jq
- select just the most recent date if multiple dates
- sort the results
- ouput the app name and date to csv
From the terminal:
mdls -name _kMDItemPSIDPath -name kMDItemLastUsedDate -name _kMDItemContentChangeDate -plist - /Applications/* |
yq e -p=xml -o=json |
jq '[ .plist.array.dict[] | { app: .string | split("Applications/") | .[1], date: ( .date | if type=="array" then . else [.] end | max | split("T") | .[0] ) } ] | sort_by(.date) | reverse | .[] | [.date, .app] | @csv'