How to return app version in terminal on osx

You could use tr as well:

FirefoxmdlsVersion= mdls -name kMDItemVersion /Applications/Firefox.app | tr -d ".";

Which produces 3405 (From Firefox 34.0.5)


If you have Xcode and the developer tools installed, you can always use PlistBuddy...

For example:

/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" /Applications/TextEdit.app/Contents/Info.plist

gives me back the version number of "1.10" under Yosemite.

The Info.plist file of any app usually has a version under the "CFBundleShortVersionString" key.

Tags:

Macos

Terminal