I wrote a (relatively) quick script to automate a somewhat repetitive task for me: checking for basic information about an application installed on my Mac. It will quickly tell you the basic details about your app, and can be pretty easily customized.
By default, it tells you:
- Location: where the first instance of your app is found based on spotlight results
- Bundle ID: the bundle identifier for the application (e.g.
com.brettterpstra.marked2
) - Size: The size of the application bundle (in human readable format)
- Version: the version of the installed binary
- Released: the release date of the app (based on Created Date)
- Purchased: if the app came from the Mac App Store, it will tell you the date you purchased it
- Last Used: the last time the application was launched
- Category: the primary App Store category of the app (most apps these days provide this info even if they’re not sold through the MAS)
- Copyright: the copyright line from the App Bundle
- Icon: if you use iTerm2 and have the
imgcat
utility installed, it will display a small version of the icon
Installation
Grab the gist. Save it as appinfo
in a location in your $PATH
. Make it executable (chmod a+x ~/scripts/appinfo
).
Usage
To run it, just type appinfo app_name
, where app_name
is a string to search for. All arguments are concatenated, so you can use spaces without quoting, e.g. appinfo marked 2
. It’s not an overly complex search, basically just “kind:app [args list]”.
The script uses the Spotlight CLI mdfind
to locate the specified application. This just turned out to be faster than my older methods that would first check default application folders and then fall back to a spotlight search.
It uses mdls to gather most of the info, but you can look at the show_icon
function to see how to pull info straight from the apps Info.plist file.
You can customize the fields returned by directly editing the config section at the top of the script. It’s a hash where each entry contains the metadataquery key and the “pretty” name used for output display. You can also turn off the icon display by setting :use_imgcat
to false.
It’s handy to me. I’m not sure it’s of much use to most people, but I thought I’d share. Grab the script from this gist.