A command for finding an application's version number?
Hello,
I need a command for finding the version number of a specific application installed in OS X, and I need to be able to run it via the UNIX feature of Apple Remote Desktop, so that I can run it on hundreds of computers. First I tried this:
system_profiler -detailLevel full
It works, but it takes a long time to produce the output, because it's gathering and outputting all of the information that System Profiler provides. I don't know if there's a way to narrow it down so that it only gives me the version number of the specific application I need to know about. This is an example of what the output looks like for each application listed.
iPhoto:
Version: 9.2.1
Last Modified: 10/27/11 10:05 AM
Kind: Intel
64-Bit (Intel): No
App Store: No
Location: /Applications/iPhoto.app
Copying that to TextEdit and searching for the application's name takes way too long, especially for hundreds of computers. Are there any arguments or regular expressions I could add to the command to narrow it down, and make it only output the information I need?
Someone suggested this command, which takes the information from Spotlight:
mdls -name kMDItemVersion <path to file>
That works for apps in the Applications folder, but the application I need the version number for is in the /usr/bin folder and I'm guessing that's not indexed by Spotlight, because it returns:
kMDItemVersion = (null)
Any help would be greatly appreciated!
-Mike