Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

I need a terminal command for finding an application's version number.

Hello,


I need a terminal command for finding the version number of an application installed in OS X. Right now I have this, which works but takes a long time:


system_profiler -detailLevel full


And that takes a few minutes to run, then produces a giant list of all System Profiler information, then I copy/paste it into TextEdit and search for the application's name, and the version number is below it. This is an example of what it 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


Basically, I need a terminal command in which I can include the application's name in the command, and then have it quickly return the version number. I assume this would include grep and regular expressions, but I don't know how to write them, and I don't even know if that terminal command I'm using is the most efficent way to do this. I need it to be fast because I'm going to be running it on hundreds of computers via Apple Remote Desktop. Thank you for any help you can provide.


-Mike

Mac Pro

Posted on Oct 28, 2011 7:41 PM

Reply
6 replies

Oct 28, 2011 8:34 PM in response to ITdept012

Well, there are two ways and both are reasonably quick:


For basic info, open Applications folder in column view, highlight an application and you get the version number and a couple of other things.


Other than that, it'd be System Profiler (and there is no terminal command needed for that - just open System Profiler).


Edit: Just noticed you want to do this on hundreds........ so hopefully someone will chime in with a terminal command.....

Oct 28, 2011 8:52 PM in response to babowa

Yeah, thanks fo your response though! 🙂


I need to run it via the UNIX command in ARD, because I need to run it on hundreds of computers, and often don't have the ability to remote control their computer. I'm hoping there's a different command to run than system_profiler, because it outputs way more information than I need.

Oct 28, 2011 9:48 PM in response to ITdept012

I don't know if this would work remotely, but for local apps that are indexed by Spotlight you can use a command like


mdls -name kMDItemVersion <path to file>


So for iPhoto.app in my /Applications folder, I get:


--------------------

$ mdls -name kMDItemVersion /Applications/iPhoto.app


kMDItemVersion = "8.1.2"

-----------------------

I need a terminal command for finding an application's version number.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.